Merge remote-tracking branch 'frps/master' into frp-master

This commit is contained in:
syruan 2025-09-01 22:17:31 +08:00
commit 6262a382c2
15 changed files with 337 additions and 34 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

@ -86,6 +86,22 @@ public class SelectController {
}
}
/**
* 领用工程下拉选
* @param bmProject
* @return
*/
@ApiOperation(value = "领用工程下拉选")
@PostMapping("getLeaseProjectList")
public AjaxResult getLeaseProjectList(@RequestBody BmProject bmProject) {
try {
return service.getLeaseProjectList(bmProject);
} catch (Exception e) {
log.error("获取数据失败");
return AjaxResult.error("获取数据失败");
}
}
@ApiOperation(value = "机具类型下拉选")
@PostMapping("getMaTypeData")
public AjaxResult getMaTypeData(@RequestBody SelectDto dto){
@ -157,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

@ -301,4 +301,18 @@ public interface SelectMapper {
List<TypeTreeNode> getBzUseTypeTreeL4(BackApplyInfo bean);
List<TreeNode> getDeviceTypeTreeTwo(SelectDto dto);
/**
* 获取工程下拉选
* @param bmProject
* @return
*/
List<ProjectTreeNode> getLeaseProjectList(BmProject bmProject);
/**
* 获取设备类型树3级
* @param dto
* @return
*/
List<TreeNode> getDeviceTypeTreeThree(SelectDto dto);
}

View File

@ -259,4 +259,18 @@ public interface SelectService {
* @return
*/
AjaxResult getBzUseTypeTree(BackApplyInfo bean);
/**
* 领用工程下拉选
* @param bmProject
* @return
*/
AjaxResult getLeaseProjectList(BmProject bmProject);
/**
* 设备类型树
* @param dto
* @return
*/
AjaxResult getDeviceTypeTreeThree(SelectDto dto);
}

View File

@ -415,6 +415,54 @@ public class SelectServiceImpl implements SelectService {
return AjaxResult.success(groupList);
}
/**
* 领用工程下拉选
* @param bmProject
* @return
*/
@Override
public AjaxResult getLeaseProjectList(BmProject bmProject) {
// 获取登陆用户的组织ID
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
// 判断是否开启过滤
if (Objects.nonNull(bmProject) && Objects.nonNull(bmProject.getEnableFilter()) && bmProject.getEnableFilter()) {
bmProject.setDeptId(thisLoginUserDeptId);
}
List<ProjectTreeNode> groupList = new ArrayList<>();
List<ProjectTreeNode> list = new ArrayList<>();
try {
list = mapper.getLeaseProjectList(bmProject);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
ProjectTreeBuild treeBuild = new ProjectTreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("工程类型树-查询失败", e);
}
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

@ -249,4 +249,6 @@ public class Type extends BaseEntity {
@ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType;
@ApiModelProperty(value = "待出库数量")
private BigDecimal pendingOutNum;
}

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

@ -13,6 +13,8 @@ import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.mapper.LeaseTaskMapper;
import com.bonus.material.ma.domain.MaTypeHistory;
import com.bonus.material.ma.domain.TypeKeeper;
import com.bonus.material.ma.domain.TypeRepair;
@ -49,6 +51,9 @@ public class TypeServiceImpl implements ITypeService {
@Resource
private TypeMapper typeMapper;
@Resource
private LeaseTaskMapper leaseTaskMapper;
@Resource
private ITypeKeeperService typeKeeperService;

View File

@ -345,7 +345,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
UNION
SELECT DISTINCT
concat( 'gs', sd.dept_id ) AS id,
sd.dept_name AS proName,
sd.dept_name AS name,
'0' AS parentId,
1 AS level
FROM
@ -925,4 +925,81 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
</select>
<select id="getLeaseProjectList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
/*根据往来单位id关联协议查询工程*/
SELECT
*
FROM
(
SELECT
bmp.pro_id AS id,
bmp.pro_name AS name,
concat( 'gs', bmp.imp_unit ) AS parentId,
2 AS level
FROM
bm_project bmp
LEFT JOIN sys_dept sd ON sd.dept_id = bmp.imp_unit
WHERE
sd.del_flag = '0'
AND sd.`status` = '0'
AND bmp.del_flag = '0'
<if test="deptId != null">
AND bmp.imp_unit = #{deptId}
</if>
UNION
SELECT DISTINCT
concat( 'gs', sd.dept_id ) AS id,
sd.dept_name AS name,
'0' AS parentId,
1 AS level
FROM
sys_dept sd
LEFT JOIN bm_project bmp ON sd.dept_id = bmp.imp_unit
WHERE
bmp.pro_id IS NOT NULL
AND sd.del_flag = '0'
AND sd.`status` = '0'
AND bmp.del_flag = '0'
<if test="deptId != null">
AND bmp.imp_unit = #{deptId}
</if>
) a
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

@ -875,6 +875,7 @@
select workflow_status from sys_workflow_record
where
task_id = #{taskId}
Limit 1
</select>
<insert id="insertWorkOrderPeople">
@ -1164,39 +1165,63 @@
</select>
<select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT
a.typeId,
SUM(a.preNum) as preNum,
SUM(a.alNum) as alNum,
SUM(a.preNum)-SUM(a.alNum) as pendingOutNum,
ifnull(mt.storage_num,0) as storageNum
FROM
(
#{typeId} as typeId,
COALESCE(SUM(combined.pendingOutNum), 0) as pendingOutNum,
CASE mt.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(mt.storage_num, 0)
END as storageNum
FROM (
SELECT
type_id as typeId,
SUM(pre_num) as preNum,
SUM(al_num) as alNum
lad.type_id as typeId,
SUM(pre_num) - SUM(al_num) as pendingOutNum
FROM
lease_apply_details
lease_apply_info lai
LEFT JOIN lease_apply_details lad ON lad.parent_id = lai.id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
WHERE
type_id =#{typeId}
and new_type is null
GROUP BY type_id
tt.task_status = '3'
AND tt.task_type = '2'
AND lad.type_id = #{typeId}
GROUP BY lad.type_id
UNION
UNION ALL
SELECT
new_type as typeId,
SUM(pre_num) as preNum,
SUM(al_num) as alNum
lpd.new_type as typeId,
SUM(lpd.num) - IFNULL(lod.alNum, 0) as pendingOutNum
FROM
lease_apply_details
lease_publish_details lpd
LEFT JOIN (
SELECT
lod.type_id as typeId,
SUM(lod.out_num) as alNum
FROM
lease_out_details lod
WHERE
new_type = #{typeId}
and new_type is not null
GROUP BY new_type
) a
LEFT JOIN ma_type mt on mt.type_id=a.typeId
GROUP BY typeId
publish_task is not null
AND lod.type_id = #{typeId}
GROUP BY lod.type_id
) lod ON lpd.new_type = lod.typeId
WHERE
lpd.new_type = #{typeId}
GROUP BY lpd.new_type
) combined
RIGHT JOIN (SELECT #{typeId} as type_id) param ON combined.typeId = param.type_id
LEFT JOIN ma_type mt ON mt.type_id = param.type_id
left join (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (1)
and mm.type_id=#{typeId}
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = param.type_id
GROUP BY param.type_id
</select>
<select id="selectLeaseApplyDetailsCountByParentId" resultType="java.lang.Integer">
SELECT

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>

View File

@ -525,7 +525,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ELSE
IFNULL(m.storage_num, 0)
END as storage_num,
m.company_id as companyId
m.company_id as companyId,
IFNULL(subquery1.pendingOutNum,0) as pendingOutNum
from ma_type m
left join (SELECT mt.type_id,
mt2.type_name AS typeName,
@ -536,6 +537,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
LEFT JOIN (
SELECT
combined.typeId AS typeId,
COALESCE ( SUM( combined.pendingOutNum ), 0 ) AS pendingOutNum
FROM
(-- 第一个查询
SELECT
lad.type_id AS typeId,
SUM( pre_num ) - SUM( al_num ) AS pendingOutNum
FROM
lease_apply_info lai
LEFT JOIN lease_apply_details lad ON lad.parent_id = lai.id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
WHERE
tt.task_status = '3'
AND tt.task_type = '2'
GROUP BY
lad.type_id UNION ALL-- 第二个查询
SELECT
lpd.new_type AS typeId,
SUM( lpd.num ) - IFNULL( lod.alNum, 0 ) AS pendingOutNum
FROM
lease_publish_details lpd
LEFT JOIN (
SELECT
lod.type_id AS typeId,
SUM( lod.out_num ) AS alNum
FROM
lease_out_details lod
WHERE
publish_task IS NOT NULL
GROUP BY
lod.type_id
) lod ON lpd.new_type = lod.typeId
GROUP BY
lpd.new_type
) combined
GROUP BY
combined.typeId
) subquery1 on subquery1.typeId=m.type_id
<where>
m.del_flag = '0'
<if test="typeName != null and typeName !=''">