配件管理新增bug修改 机具状态导出问题修改
This commit is contained in:
parent
2894862a48
commit
8527b34ab9
|
|
@ -66,6 +66,7 @@ public class MaPartTypeController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody MaPartType maPartType) {
|
public AjaxResult add(@Validated @RequestBody MaPartType maPartType) {
|
||||||
|
System.out.println(maPartType);
|
||||||
if (!maPartTypeService.checkPaNameUnique(maPartType)) {
|
if (!maPartTypeService.checkPaNameUnique(maPartType)) {
|
||||||
return error("新增配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
|
return error("新增配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,5 +52,9 @@ public interface MaPartTypeMapper {
|
||||||
MaPartType getById(Long paId);
|
MaPartType getById(Long paId);
|
||||||
|
|
||||||
int updateById(MaPartType maPartType);
|
int updateById(MaPartType maPartType);
|
||||||
|
|
||||||
|
int checkPartName(String paName);
|
||||||
|
|
||||||
|
List<MaPartType> selectPartName(String paName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,35 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPaNameUnique(MaPartType maPartType) {
|
public boolean checkPaNameUnique(MaPartType maPartType) {
|
||||||
Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
|
// Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
|
||||||
MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
|
// MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
|
||||||
if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
|
// if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
|
||||||
|
// return UserConstants.NOT_UNIQUE;
|
||||||
|
// }
|
||||||
|
// 查询具有相同paName的所有MaPartType对象
|
||||||
|
List<MaPartType> maPartTypes = maPartTypeMapper.selectPartName(maPartType.getPaName());
|
||||||
|
|
||||||
|
// 用于存储第一个level=1的MaPartType的索引
|
||||||
|
Integer num = null;
|
||||||
|
|
||||||
|
// 遍历查询结果
|
||||||
|
for (int i = 0; i < maPartTypes.size(); i++) {
|
||||||
|
MaPartType maPart = maPartTypes.get(i);
|
||||||
|
if ("1".equals(maPart.getLevel())) {
|
||||||
|
// 如果找到level=1的MaPartType,则记录其索引
|
||||||
|
num = i;
|
||||||
|
break; // 假设我们只需要第一个找到的,所以找到后退出循环
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否存在相同paName的条目,并且该条目level为1
|
||||||
|
int count = maPartTypeMapper.checkPartName(maPartType.getPaName());
|
||||||
|
if (count > 0 && num != null && maPartTypes.get(num).getLevel().equals("1")) {
|
||||||
|
// 如果存在且找到的条目level为1,则名称不唯一
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果没有找到符合条件的条目,则名称唯一
|
||||||
return UserConstants.UNIQUE;
|
return UserConstants.UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public class BackRecordController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BackRecordService backRecordService;
|
private BackRecordService backRecordService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退料记录列表
|
* 退料记录列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -112,14 +112,12 @@ public class StorageStatus {
|
||||||
* 租赁数量
|
* 租赁数量
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "租赁数量")
|
@ApiModelProperty(value = "租赁数量")
|
||||||
@Excel(name = "租赁数量",cellType = Excel.ColumnType.NUMERIC)
|
|
||||||
private Integer outNum;
|
private Integer outNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 归还数量
|
* 归还数量
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "归还数量")
|
@ApiModelProperty(value = "归还数量")
|
||||||
@Excel(name = "归还数量",cellType = Excel.ColumnType.NUMERIC)
|
|
||||||
private Integer backNum;
|
private Integer backNum;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,4 +105,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
from ma_part_type
|
from ma_part_type
|
||||||
where pa_id = #{paId}
|
where pa_id = #{paId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="checkPartName" resultType="java.lang.Integer">
|
||||||
|
select count(*) from ma_part_type where pa_name = #{paName}
|
||||||
|
</select>
|
||||||
|
<select id="selectPartName" resultType="com.bonus.sgzb.base.domain.MaPartType">
|
||||||
|
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
|
||||||
|
from ma_part_type
|
||||||
|
where pa_name = #{paName}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -399,7 +399,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where task_id = #{taskId} and rd.STATUS = '0'
|
where task_id = #{taskId} and rd.STATUS = '0'
|
||||||
</select>
|
</select>
|
||||||
<select id="getPartRecord" resultType="com.bonus.sgzb.material.domain.RepairPart">
|
<select id="getPartRecord" resultType="com.bonus.sgzb.material.domain.RepairPart">
|
||||||
select mpt.pa_name as partName,
|
select concat(mpt2.pa_name,'-',mpt1.pa_name,'-',mpt.pa_name) as partName,
|
||||||
rpd.part_num as partNum,
|
rpd.part_num as partNum,
|
||||||
rpd.part_cost as partCost,
|
rpd.part_cost as partCost,
|
||||||
rpd.part_type as partType,
|
rpd.part_type as partType,
|
||||||
|
|
@ -407,6 +407,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
rpd.repair_content as repairContent
|
rpd.repair_content as repairContent
|
||||||
from repair_part_details rpd
|
from repair_part_details rpd
|
||||||
left join ma_part_type mpt on mpt.pa_id = rpd.part_id
|
left join ma_part_type mpt on mpt.pa_id = rpd.part_id
|
||||||
|
left join ma_part_type mpt1 on mpt1.pa_id = mpt.parent_id
|
||||||
|
left join ma_part_type mpt2 on mpt2.pa_id = mpt1.parent_id
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="taskId != null and taskId != ''">
|
<if test="taskId != null and taskId != ''">
|
||||||
and rpd.task_id = #{taskId}
|
and rpd.task_id = #{taskId}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue