parent
ad51b543b6
commit
3a3ddb1f0e
10 changed files with 535 additions and 8 deletions
@ -0,0 +1,87 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.dashboard.pojo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* 磨具变更表 实体类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-06-09 |
||||
*/ |
||||
@Data |
||||
@TableName("DS_MOLD_CHANGE") |
||||
@Schema(description = "DsMoldChange对象") |
||||
@EqualsAndHashCode(callSuper = false) |
||||
public class DsMoldChangeEntity extends BaseEntity { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* ID编号 |
||||
*/ |
||||
@Schema(description = "ID编号") |
||||
private Long id; |
||||
|
||||
/** |
||||
* 物料号 |
||||
*/ |
||||
@Schema(description = "物料号") |
||||
private String partCode; |
||||
|
||||
/** |
||||
* 变更类型:1.新图 2.变更 |
||||
*/ |
||||
@Schema(description = "变更类型:1.新图 2.变更") |
||||
private Integer changeType; |
||||
|
||||
/** |
||||
* 处理方式:1.模具布置 2.库存报废 |
||||
*/ |
||||
@Schema(description = "处理方式:1.模具布置 2.库存报废") |
||||
private String processMode; |
||||
|
||||
/** |
||||
* 状态 |
||||
*/ |
||||
@Schema(description = "状态") |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 逻辑删除 |
||||
*/ |
||||
@Schema(description = "逻辑删除:0未删除 1已删除") |
||||
private Integer isDeleted; |
||||
|
||||
} |
||||
@ -0,0 +1,64 @@ |
||||
package org.springblade.desk.dashboard.pojo.enums; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Getter; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springblade.core.tool.utils.StringPool; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* 枚举 烧结模具计划 - 申报 |
||||
* |
||||
* @author lqk |
||||
* @date 2025-12-19 9:25 |
||||
*/ |
||||
@Getter |
||||
@AllArgsConstructor |
||||
public enum DsMoldChangeEnum { |
||||
EMPTY(StringPool.EMPTY, -1), |
||||
|
||||
/** |
||||
* 变更类型 |
||||
*/ |
||||
NEW_LAYER("新图", 1001), |
||||
CHANGE("变更", 1002), |
||||
|
||||
/** |
||||
* 处理方式 |
||||
*/ |
||||
MOLD_REPAIR("模具补制", 2001), |
||||
INVENTORY_WRITE_OFF("库存报废", 2002), |
||||
|
||||
; |
||||
final String name; |
||||
final int code; |
||||
|
||||
/** |
||||
* 匹配枚举值 |
||||
* |
||||
* @param name 名称 |
||||
* @return BladeUserEnum |
||||
*/ |
||||
public static DsMoldChangeEnum of(String name) { |
||||
return Arrays.stream(DsMoldChangeEnum.values()) |
||||
.filter(userEnum -> userEnum.getName().equalsIgnoreCase(name != null ? name : "web")) |
||||
.findFirst() |
||||
// 在没有找到匹配项时返回默认值
|
||||
.orElse(DsMoldChangeEnum.EMPTY); |
||||
} |
||||
|
||||
/** |
||||
* 根据值获取名称 |
||||
* |
||||
* @param category |
||||
* @return |
||||
*/ |
||||
public static String getName(int category) { |
||||
DsMoldChangeEnum item = Arrays.stream(DsMoldChangeEnum.values()) |
||||
.filter(enumItem -> enumItem.getCode() == category) |
||||
.findFirst() |
||||
.orElse(null); |
||||
return ObjectUtil.isEmpty(item) ? StringPool.EMPTY : item.getName(); |
||||
} |
||||
} |
||||
@ -0,0 +1,56 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.dashboard.pojo.vo; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.desk.dashboard.pojo.entity.DsMoldChangeEntity; |
||||
|
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* 模具变更 视图实体类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2025-11-12 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class DsMoldChangeVO extends DsMoldChangeEntity { |
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 类型名称 |
||||
*/ |
||||
private String changeTypeStr; |
||||
|
||||
/** |
||||
* 处理方式 |
||||
*/ |
||||
private String processModeStr; |
||||
|
||||
} |
||||
@ -0,0 +1,84 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.dashboard.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import jakarta.validation.Valid; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.desk.dashboard.pojo.entity.BsCraftAbilityEntity; |
||||
import org.springblade.desk.dashboard.pojo.entity.DsMoldChangeEntity; |
||||
import org.springblade.desk.dashboard.pojo.vo.DsMoldChangeVO; |
||||
import org.springblade.desk.dashboard.pojo.vo.DsPartVO; |
||||
import org.springblade.desk.dashboard.service.IDsMoldChangeService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
/** |
||||
* 磨具变更 控制器 |
||||
* |
||||
* @author BladeX |
||||
* @since 2025-11-12 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/bsMoldChange") |
||||
@Tag(name = "磨具变更", description = "磨具变更接口") |
||||
public class DsMoldChangeController extends BladeController { |
||||
|
||||
@Autowired |
||||
IDsMoldChangeService moldChangeService; |
||||
|
||||
/** |
||||
* 磨具变更 自定义分页 |
||||
*/ |
||||
@GetMapping("/list") |
||||
@ApiOperationSupport(order = 3) |
||||
@Operation(summary = "分页", description = "传入moldChange") |
||||
public R<IPage<DsMoldChangeVO>> page(DsMoldChangeVO moldChange, Query query) { |
||||
|
||||
IPage<DsMoldChangeVO> pages = moldChangeService.selectDsMoldChangePage(Condition.getPage(query), moldChange); |
||||
|
||||
return R.data(pages); |
||||
} |
||||
|
||||
/** |
||||
* 工艺能力表 新增 |
||||
*/ |
||||
@PostMapping("/save") |
||||
@ApiOperationSupport(order = 4) |
||||
@Operation(summary = "新增", description = "传入moldChange") |
||||
public R save(@Valid @RequestBody DsMoldChangeVO moldChange) { |
||||
return R.status(moldChangeService.saveMoldChange(moldChange)); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,50 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.dashboard.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.springblade.desk.dashboard.excel.BsCraftAbilityExcel; |
||||
import org.springblade.desk.dashboard.pojo.entity.BsCraftAbilityEntity; |
||||
import org.springblade.desk.dashboard.pojo.entity.DsMoldChangeEntity; |
||||
import org.springblade.desk.dashboard.pojo.vo.BsCraftAbilityVO; |
||||
import org.springblade.desk.dashboard.pojo.vo.DsMoldChangeVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 工艺能力表 Mapper 接口 |
||||
* |
||||
* @author BladeX |
||||
* @since 2025-11-12 |
||||
*/ |
||||
public interface DsMoldChangeMapper extends BaseMapper<DsMoldChangeEntity> { |
||||
|
||||
|
||||
List<DsMoldChangeVO> selectDsMoldChangePage(IPage<DsMoldChangeVO> page, @Param("moldChange")DsMoldChangeVO moldChange); |
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.springblade.desk.dashboard.mapper.DsMoldChangeMapper"> |
||||
|
||||
|
||||
<select id="selectDsMoldChangePage" resultType="org.springblade.desk.dashboard.pojo.vo.DsMoldChangeVO"> |
||||
select * from DS_MOLD_CHANGE where IS_DELETED = 0 |
||||
<if test="moldChange.partCode != null and moldChange.partCode != ''"> |
||||
AND PART_CODE LIKE '%' || #{moldChange.partCode} || '%' |
||||
</if> |
||||
</select> |
||||
|
||||
</mapper> |
||||
@ -0,0 +1,53 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.dashboard.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.desk.dashboard.pojo.entity.DsMoldChangeEntity; |
||||
import org.springblade.desk.dashboard.pojo.vo.DsMoldChangeVO; |
||||
|
||||
/** |
||||
* 模具变更 |
||||
* @author BladeX |
||||
*/ |
||||
public interface IDsMoldChangeService extends BaseService<DsMoldChangeEntity> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* @param page |
||||
* @param moldChange |
||||
* @return |
||||
*/ |
||||
IPage<DsMoldChangeVO> selectDsMoldChangePage(IPage<DsMoldChangeVO> page, DsMoldChangeVO moldChange); |
||||
|
||||
/** |
||||
* 新增磨具 |
||||
* @param moldChange |
||||
* @return |
||||
*/ |
||||
boolean saveMoldChange(DsMoldChangeVO moldChange); |
||||
} |
||||
@ -0,0 +1,120 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.dashboard.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import jodd.util.StringPool; |
||||
import jodd.util.StringUtil; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.desk.dashboard.mapper.DsMoldChangeMapper; |
||||
import org.springblade.desk.dashboard.pojo.entity.DsMoldChangeEntity; |
||||
import org.springblade.desk.dashboard.pojo.enums.DsMoldChangeEnum; |
||||
import org.springblade.desk.dashboard.pojo.vo.DsMoldChangeVO; |
||||
import org.springblade.desk.dashboard.service.IDsMoldChangeService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 模具变更 服务实现类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2025-11-12 |
||||
*/ |
||||
@Service |
||||
public class DsMoldChangeServiceImpl extends BaseServiceImpl<DsMoldChangeMapper, DsMoldChangeEntity> implements IDsMoldChangeService { |
||||
|
||||
@Override |
||||
public IPage<DsMoldChangeVO> selectDsMoldChangePage(IPage<DsMoldChangeVO> page, DsMoldChangeVO moldChange) { |
||||
List<DsMoldChangeVO> moldChangeList = baseMapper.selectDsMoldChangePage(page, moldChange); |
||||
for (DsMoldChangeVO dsMoldChangeVO : moldChangeList) { |
||||
// 处理变更类型
|
||||
Integer changeType = dsMoldChangeVO.getChangeType(); |
||||
dsMoldChangeVO.setChangeTypeStr(DsMoldChangeEnum.getName(changeType)); |
||||
|
||||
// 处理处理方式
|
||||
String processMode = dsMoldChangeVO.getProcessMode(); |
||||
if (StringUtil.isNotBlank(processMode)) { |
||||
String processModeStr = Arrays.stream(processMode.split(",")) |
||||
.map(String::trim) |
||||
.filter(StringUtil::isNotBlank) |
||||
.mapToInt(Integer::parseInt) |
||||
.mapToObj(DsMoldChangeEnum::getName) |
||||
.filter(StringUtil::isNotBlank) |
||||
.collect(Collectors.joining("、")); |
||||
dsMoldChangeVO.setProcessModeStr(processModeStr); |
||||
} |
||||
} |
||||
return page.setRecords(moldChangeList); |
||||
} |
||||
|
||||
@Override |
||||
public boolean saveMoldChange(DsMoldChangeVO moldChange) { |
||||
this.save(moldChange); |
||||
|
||||
String processMode = moldChange.getProcessMode(); |
||||
|
||||
if (StringUtil.isNotBlank(processMode)) { |
||||
String[] modeArray = processMode.split(","); |
||||
Set<Integer> modeSet = Arrays.stream(modeArray) |
||||
.map(String::trim) |
||||
.filter(StringUtil::isNotBlank) |
||||
.map(Integer::parseInt) |
||||
.collect(Collectors.toSet()); |
||||
|
||||
// 根据不同的处理方式执行相应逻辑
|
||||
if (modeSet.contains(DsMoldChangeEnum.MOLD_REPAIR.getCode()) && modeSet.contains(DsMoldChangeEnum.INVENTORY_WRITE_OFF.getCode())) { |
||||
this.handleMoldRepair(moldChange); |
||||
this.handleInventoryWriteOff(moldChange); |
||||
} else if (modeSet.contains(DsMoldChangeEnum.MOLD_REPAIR.getCode())) { |
||||
this.handleMoldRepair(moldChange); |
||||
} else if (modeSet.contains(DsMoldChangeEnum.INVENTORY_WRITE_OFF.getCode())) { |
||||
this.handleInventoryWriteOff(moldChange); |
||||
} |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* 处理模具补制逻辑 |
||||
*/ |
||||
private void handleMoldRepair(DsMoldChangeVO moldChange) { |
||||
// TODO: 实现模具补制的业务逻辑
|
||||
// 例如:创建模具补制工单、更新模具状态等
|
||||
} |
||||
|
||||
/** |
||||
* 处理库存报废逻辑 |
||||
*/ |
||||
private void handleInventoryWriteOff(DsMoldChangeVO moldChange) { |
||||
// TODO: 实现库存报废的业务逻辑
|
||||
// 例如:创建报废单、扣减库存、更新物料状态等
|
||||
} |
||||
} |
||||
Loading…
Reference in new issue