库存日志记录

This commit is contained in:
mashuai 2024-12-20 21:11:36 +08:00
parent 1bcd5b8993
commit 62443b4c8f
4 changed files with 27 additions and 28 deletions

View File

@ -224,7 +224,7 @@ public class StoreLogAspect {
//修饰入库库存变化 /repair_input_details/warehouse
if (joinPoint.getArgs()[0] instanceof RepairInputDetails) {
RepairInputDetails repairInputDetails = (RepairInputDetails) joinPoint.getArgs()[0];
if (repairInputDetails.getTaskId() != null && repairInputDetails.getTypeId() != null && CollectionUtils.isEmpty(repairInputDetails.getTaskIdList())) {
if (repairInputDetails.getTaskId() != null && repairInputDetails.getTypeId() != null && CollectionUtils.isEmpty(repairInputDetails.getOutTaskList())) {
// 内层入库
BmStorageLog bmStorageLog = new BmStorageLog();
bmStorageLog.setTaskId(String.valueOf(repairInputDetails.getTaskId()));
@ -248,7 +248,7 @@ public class StoreLogAspect {
bmStorageLog.setPostStoreNum(repairInputDetails.getPreStoreNum().add(bmStorageLog.getInNum()));
bmStorageLogList.add(bmStorageLog);
// 外层入库
} else if (CollectionUtils.isNotEmpty(repairInputDetails.getTaskIdList())) {
} else if (CollectionUtils.isNotEmpty(repairInputDetails.getOutTaskList())) {
for (RepairInputDetails inputDetails : repairInputDetails.getDetailsList()) {
BmStorageLog bmStorageLog = new BmStorageLog();
bmStorageLog.setTaskId(String.valueOf(inputDetails.getTaskId()));
@ -258,11 +258,7 @@ public class StoreLogAspect {
// 编码类型入库
if (inputDetails.getManageType().equals(String.valueOf(InputOutEnum.CODE_DEVICE.getTypeId()))) {
bmStorageLog.setManageType(String.valueOf(InputOutEnum.CODE_DEVICE.getTypeId()));
String maCode = inputDetails.getMaCodeList().stream()
.filter(Objects::nonNull)
.map(RepairInputDetails::getMaCode)
.collect(Collectors.joining(","));
bmStorageLog.setMaCode(maCode);
bmStorageLog.setMaCode(inputDetails.getMaCode());
bmStorageLog.setInputType(InputOutEnum.CODE_DEVICE.getTypeId());
// 数量类型入库
} else if (inputDetails.getManageType().equals(String.valueOf(InputOutEnum.NUMBER_DEVICE.getTypeId()))) {

View File

@ -33,9 +33,6 @@ public class RepairInputDetails extends BaseEntity {
private Long taskId;
@ApiModelProperty(value = "任务ID集合")
private List<Long> taskIdList;
@ApiModelProperty(value = "外层任务ID集合")
private List<RePairDto> outTaskList;
/** 维修审核ID */
@ -136,7 +133,7 @@ public class RepairInputDetails extends BaseEntity {
/**
* 关键字
*/
private String keyword;
private String keyWord;
/**
* 开始时间
*/

View File

@ -168,15 +168,18 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
int result = 0;
// 检查条件确保修试入库条件有效
if (repairInputDetails.getTaskId() != null && repairInputDetails.getTypeId() != null && CollectionUtils.isEmpty(repairInputDetails.getTaskIdList())) {
if (repairInputDetails.getTaskId() != null && repairInputDetails.getTypeId() != null && CollectionUtils.isEmpty(repairInputDetails.getOutTaskList())) {
// 内层入库
result += processInnerStorage(repairInputDetails);
} else if (CollectionUtils.isNotEmpty(repairInputDetails.getTaskIdList())) {
} else if (CollectionUtils.isNotEmpty(repairInputDetails.getOutTaskList())) {
// 查询外层任务列表仅供库存日志使用
List<RepairInputDetails> list = repairInputDetailsMapper.selectRepairDetails(repairInputDetails.getTaskIdList());
List<Long> taskIdList = repairInputDetails.getOutTaskList().stream()
.map(RePairDto::getTaskId)
.collect(Collectors.toList());
List<RepairInputDetails> list = repairInputDetailsMapper.selectRepairDetails(taskIdList);
if (CollectionUtils.isNotEmpty(list)) {
for (RepairInputDetails inputDetails : list) {
repairInputDetails.setPreStoreNum(getStorageNum(inputDetails));
inputDetails.setPreStoreNum(getStorageNum(inputDetails));
}
}
repairInputDetails.setDetailsList(list);
@ -581,8 +584,8 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
*/
private int processOuterStorage(RepairInputDetails repairInputDetails) {
int result = 0;
for (Long taskId : repairInputDetails.getTaskIdList()) {
result += processRepairTask(taskId);
for (RePairDto rePairDto : repairInputDetails.getOutTaskList()) {
result += processRepairTask(rePairDto.getTaskId());
}
return result;
}
@ -633,6 +636,7 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
repairInputInfo.setInputNum(repairInputInfo.getPendingInputNum());
result += repairInputDetailsMapper.updateNum(repairInputInfo);
} else if ("0".equals(repairInputInfo.getManageType())) {
repairInputInfo.setStatus(MaMachineStatusEnum.IN_STORE.getStatus().toString());
result += repairInputDetailsMapper.updateMaStatus(repairInputInfo);
}

View File

@ -59,14 +59,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id and bpi.del_flag = '0'
left join sys_user su on rd.create_by = su.user_id
<where>
<if test="keyword != null and keyword != ''">
<if test="keyWord != null and keyWord != ''">
AND (
locate(#{keyword}, su.nick_name) > 0
or locate(#{keyword}, tt.CODE) > 0
or locate(#{keyword}, tt1.CODE) > 0
or locate(#{keyword}, bui.unit_name) > 0
or locate(#{keyword}, bpi.pro_name) > 0
or locate(#{keyword}, su.nick_name) > 0
locate(#{keyWord}, su.nick_name) > 0
or locate(#{keyWord}, tt.CODE) > 0
or locate(#{keyWord}, tt1.CODE) > 0
or locate(#{keyWord}, bui.unit_name) > 0
or locate(#{keyWord}, bpi.pro_name) > 0
or locate(#{keyWord}, su.nick_name) > 0
)
</if>
<if test="taskStatus != null ">
@ -106,11 +106,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
LEFT JOIN tm_task_agreement tta ON rid.task_id = tta.task_id
where rid.task_id = #{taskId}
<if test="keyword != null and keyword != ''">
<if test="keyWord != null and keyWord != ''">
AND (
locate(#{keyword}, mt1.type_name) > 0
or locate(#{keyword}, mt.type_name) > 0
or locate(#{keyword}, mt.unit_name) > 0
locate(#{keyWord}, mt1.type_name) > 0
or locate(#{keyWord}, mt.type_name) > 0
or locate(#{keyWord}, mt.unit_name) > 0
)
</if>
GROUP BY rid.type_id
@ -208,6 +208,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt1.del_flag = '0'
LEFT JOIN ma_machine mm ON mm.ma_id = rd.ma_id
WHERE
(mm.ma_status != 1 or mm.ma_status is null) and
rd.`status` = '0' and
rd.task_id IN
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}