Merge remote-tracking branch 'origin/master'

This commit is contained in:
liang.chao 2024-09-25 15:15:13 +08:00
commit 94f31b5f0d
8 changed files with 100 additions and 33 deletions

View File

@ -66,6 +66,7 @@ public class MaPartTypeController extends BaseController {
*/
@PostMapping
public AjaxResult add(@Validated @RequestBody MaPartType maPartType) {
System.out.println(maPartType);
if (!maPartTypeService.checkPaNameUnique(maPartType)) {
return error("新增配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
}

View File

@ -52,5 +52,9 @@ public interface MaPartTypeMapper {
MaPartType getById(Long paId);
int updateById(MaPartType maPartType);
int checkPartName(String paName);
List<MaPartType> selectPartName(String paName);
}

View File

@ -37,11 +37,35 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
*/
@Override
public boolean checkPaNameUnique(MaPartType maPartType) {
Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
// Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
// MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
// 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.UNIQUE;
}

View File

@ -32,6 +32,7 @@ public class BackRecordController extends BaseController {
@Autowired
private BackRecordService backRecordService;
/**
* 退料记录列表
*/

View File

@ -49,9 +49,10 @@ public class SecondaryWarehouse {
/**
* 工程名称
*/
@Excel(name = "工程")
// @Excel(name = "工程")
private String proName;
/**
* 工程名称
*/
@ -59,13 +60,19 @@ public class SecondaryWarehouse {
/**
* 设备名称
*/
@Excel(name = "类型名称")
@Excel(name = "机具名称")
private String typeName;
/**
* 规格型号
*/
@Excel(name = "规格型号")
private String modelName;
/**
* 计量单位
*/
@Excel(name = "计量单位")
private String nuitName;
/**
* 规格型号id
*/
@ -73,53 +80,51 @@ public class SecondaryWarehouse {
/**
* 进场数量
*/
@Excel(name = "进场数量")
// @Excel(name = "进场数量")
private String jcNum;
/**
* 退场数量
*/
@Excel(name = "退场数量")
// @Excel(name = "退场数量")
private String tcNUm;
/**
* 场内库存量
*/
@Excel(name = "场内库存量")
private String kcNum;
/**
* 已出库数量
*/
@Excel(name = "已出库数量")
// @Excel(name = "已出库数量")
private String ckNum;
/**
* 在库数
* 场内库存
*/
@Excel(name = "在库数量")
private String zkNum;
/**
* 计量单位
*/
@Excel(name = "计量单位")
private String nuitName;
private String kcNum;
private String keyword;
/**
* 租赁类型 0工程1长期
*/
@Excel(name = "租赁类型")
// @Excel(name = "租赁类型")
private Integer leaseType;
/**
* 领用数量
*/
@Excel(name = "总量")
private Integer Num;
/**
* 库存数量
*/
@Excel(name = "库存数量")
private Integer stockNum;
/**
* 领用数量
*/
@Excel(name = "领用数量")
private Integer receiveNum;
/**
* 库存数量
*/
private Integer stockNum;
}

View File

@ -112,14 +112,12 @@ public class StorageStatus {
* 租赁数量
*/
@ApiModelProperty(value = "租赁数量")
@Excel(name = "租赁数量",cellType = Excel.ColumnType.NUMERIC)
private Integer outNum;
/**
* 归还数量
*/
@ApiModelProperty(value = "归还数量")
@Excel(name = "归还数量",cellType = Excel.ColumnType.NUMERIC)
private Integer backNum;

View File

@ -83,11 +83,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectMaPartType" parameterType="com.bonus.sgzb.base.domain.MaPartType" resultMap="MaPartTypeResult">
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 del_flag = '0'
SELECT
t1.pa_id,
t1.pa_name,
t1.parent_id,
t1.status,
t1.num,
t1.unit_id,
t1.buy_price,
t1.level,
t1.warn_num,
t1.del_flag,
t1.create_by,
t1.create_time,
t1.remark,
t1.company_id,
t1.year
FROM
ma_part_type t1
LEFT JOIN
ma_part_type t2 ON t1.parent_id = t2.pa_id
LEFT JOIN
ma_part_type t3 ON t2.parent_id = t3.pa_id
WHERE
t1.del_flag = '0'
<if test="paName != null and paName != ''">
AND pa_name like concat('%', #{paName}, '%')
AND (t1.pa_name LIKE CONCAT('%', #{paName}, '%')
OR t2.pa_name LIKE CONCAT('%', #{paName}, '%')
OR t3.pa_name LIKE CONCAT('%', #{paName}, '%'))
</if>
<if test="year != null and year != ''">
AND year = #{year}
@ -105,4 +128,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ma_part_type
where pa_id = #{paId}
</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>

View File

@ -399,7 +399,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where task_id = #{taskId} and rd.STATUS = '0'
</select>
<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_cost as partCost,
rpd.part_type as partType,
@ -407,6 +407,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
rpd.repair_content as repairContent
from repair_part_details rpd
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
<if test="taskId != null and taskId != ''">
and rpd.task_id = #{taskId}