This commit is contained in:
hayu 2025-09-01 16:28:30 +08:00
parent 27f942d77d
commit 015c852ede
11 changed files with 128 additions and 1 deletions

View File

@ -49,4 +49,7 @@ public class TreeNode {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeNode> children = new ArrayList<>();
@ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType;
}

View File

@ -173,6 +173,11 @@ public class SelectController {
return service.getDeviceTypeTreeTwo(dto);
}
@ApiOperation(value = "设备类型树--编码设备")
@PostMapping("getDeviceTypeTreeThree")
public AjaxResult getDeviceTypeTreeThree(@RequestBody SelectDto dto){
return service.getDeviceTypeTreeThree(dto);
}
@ApiOperation(value = "退料设备类型树")
@PostMapping("getBackDeviceTypeTree")

View File

@ -308,4 +308,11 @@ public interface SelectMapper {
* @return
*/
List<ProjectTreeNode> getLeaseProjectList(BmProject bmProject);
/**
* 获取设备类型树3级
* @param dto
* @return
*/
List<TreeNode> getDeviceTypeTreeThree(SelectDto dto);
}

View File

@ -266,4 +266,11 @@ public interface SelectService {
* @return
*/
AjaxResult getLeaseProjectList(BmProject bmProject);
/**
* 设备类型树
* @param dto
* @return
*/
AjaxResult getDeviceTypeTreeThree(SelectDto dto);
}

View File

@ -445,6 +445,24 @@ public class SelectServiceImpl implements SelectService {
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getDeviceTypeTreeThree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getDeviceTypeTreeThree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("单位树/归属部门/所属上级-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getDeviceTypeTree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();

View File

@ -134,6 +134,17 @@ public class MachineController extends BaseController {
return toAjax(machineService.insertMachine(machine));
}
/**
* 新增机具设备管理
*/
@ApiOperation(value = "新增机具设备管理")
@PreventRepeatSubmit
@SysLog(title = "机具设备管理", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->新增机具设备管理")
@PostMapping(value = "/addMaMachine")
public AjaxResult addMaMachine(@RequestBody Machine machine) {
return machineService.addMaMachine(machine);
}
/**
* 修改机具设备管理
*/

View File

@ -229,4 +229,11 @@ public interface MachineMapper
List<Machine> getNewByMaCode(Machine machine);
List<Machine> findMaMsgById(Machine machine);
/**
* 根据编码查询机具信息
* @param machine
* @return
*/
int getCountByMaCode(Machine machine);
}

View File

@ -146,4 +146,12 @@ public interface IMachineService
List<Machine> getNewByMaCode(Machine machine);
List<Machine> findMaMsgById(Machine machine);
/**
* 新增机具设备管理
*
* @param machine 机具设备管理
* @return 结果
*/
AjaxResult addMaMachine(Machine machine);
}

View File

@ -593,6 +593,26 @@ public class MachineServiceImpl implements IMachineService
return machineMapper.findMaMsgById(machine);
}
@Override
public AjaxResult addMaMachine(Machine machine) {
try {
//查询类型下编码是否存在
int count = machineMapper.getCountByMaCode(machine);
if (count > 0) {
return AjaxResult.error("该规格类型下此编码已存在");
}
machine.setMaStatus("1");
machine.setMaVender(machine.getSupplierId());
int result = machineMapper.insertMachine(machine);
if (result > 0) {
return AjaxResult.success("入库成功");
}
return AjaxResult.error("添加盘点入库失败");
} catch (Exception e) {
return AjaxResult.error("添加盘点入库失败");
}
}
/**
* 编码铭牌信息
* @param machine

View File

@ -968,4 +968,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY
level
</select>
<select id="getDeviceTypeTreeThree" resultType="com.bonus.common.biz.domain.TreeNode">
WITH RECURSIVE type_tree AS (
SELECT
type_id,
type_name,
parent_id,
level,
manage_type,
type_id as root_id
FROM ma_type
WHERE level = 4 AND manage_type = 0
UNION ALL
SELECT
mt.type_id,
mt.type_name,
mt.parent_id,
mt.level,
mt.manage_type,
tt.root_id
FROM ma_type mt
INNER JOIN type_tree tt ON mt.type_id = tt.parent_id
WHERE mt.level BETWEEN 1 AND 3
)
SELECT DISTINCT
type_id as id,
type_name as label,
parent_id as parentId,
level
FROM type_tree
WHERE level BETWEEN 1 AND 3
ORDER BY level, type_id
</select>
</mapper>

View File

@ -218,7 +218,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
parent_id as parentId,
storage_num as storageNum,
type_code as typeCode,
level as level
level as level,
jiju_type as jijuType
FROM
ma_type
WHERE del_flag = '0'
@ -1053,4 +1054,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ws_ma_info mi
WHERE mi.id =#{maId}
</select>
<select id="getCountByMaCode" resultType="java.lang.Integer">
SELECT count(1)
FROM ma_machine
WHERE ma_code = #{maCode}
and type_id = #{typeId}
</select>
</mapper>