修试入库

This commit is contained in:
cwchen 2023-12-17 16:10:04 +08:00
parent fad9414a7b
commit 92f726fee7
4 changed files with 35 additions and 22 deletions

View File

@ -74,9 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
/*入库*/
<if test="type == 2">
SELECT mir.input_num,
SELECT iad.input_num,
a.typeName
FROM ma_input_record mir
FROM input_apply_details iad
LEFT JOIN (
SELECT mt.type_id,mt4.type_name AS typeName
FROM ma_type mt
@ -84,8 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id AND mt3.`level` = '2'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.`level` = '1'
WHERE mt.`level` = '4'
)a ON mir.type_id = a.type_id
WHERE mir.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59') AND mir.input_type = '1'
)a ON iad.type_id = a.type_id
WHERE iad.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59') AND iad.input_type = '1'
<if test="maType!=null and maType == 1">
AND a.typeName = #{maTypeName}
</if>

View File

@ -15,4 +15,7 @@ public class RepairTestInputDto {
/** 关键字*/
private String keyWord;
/** 状态*/
private String status;
}

View File

@ -13,6 +13,7 @@ import com.bonus.sgzb.material.domain.RepairTestWarehousingDto;
import com.bonus.sgzb.material.mapper.RepairTestInputMapper;
import com.bonus.sgzb.material.service.RepairTestInputService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
@ -52,6 +53,9 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
return AjaxResult.error(HttpStatus.ERROR, "参数类型不正确");
}
List<RepairTestWarehousingDto> list = JSONObject.parseArray(params, RepairTestWarehousingDto.class);
if(CollectionUtils.isEmpty(list)){
return AjaxResult.error(HttpStatus.ERROR, "参数类型不正确");
}
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
String updateTime = DateTimeHelper.getNowTime();
String updateBy = SecurityUtils.getLoginUser().getUsername();
@ -60,7 +64,7 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
dto.setUpdateTime(updateTime);
dto.setUpdateBy(updateBy);
if (Objects.equals("2", dto.getCheckType())) {
// 审核不通过-入库数量修改为0
// 审核不通过-入库数量修改为 0
dto.setRepairNum("0");
}
// 更新修试后入库数据
@ -80,20 +84,21 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
mapper.updateMaMachineStatus(dicId,dto.getMaId());
}
}
// 查询修试后入库的状态是否全部更新更新任务表状态
Map<String, Object> numMap = mapper.getIsAllUpdate(dto);
// 总量未审核数量入库数量驳回数量
int totalNum = Integer.parseInt(String.valueOf(numMap.get("num")));
int noCheckNum = Integer.parseInt(String.valueOf(numMap.get("noCheckNum")));
int passNum = Integer.parseInt(String.valueOf(numMap.get("passNum")));
int noPassNum = Integer.parseInt(String.valueOf(numMap.get("noPassNum")));
if(passNum == totalNum){
int dicId = mapper.getDicByMaStatusId("rk_task","入库完成");
mapper.updateTmTaskStatus(dto,dicId);
}else if(noPassNum > 0){
int dicId = mapper.getDicByMaStatusId("rk_task","入库驳回");
mapper.updateTmTaskStatus(dto,dicId);
}
}
RepairTestWarehousingDto dto = list.get(0);
// 查询修试后入库的状态是否全部更新更新任务表状态
Map<String, Object> numMap = mapper.getIsAllUpdate(dto);
// 总量未审核数量入库数量驳回数量
int totalNum = Integer.parseInt(String.valueOf(numMap.get("totalNum")));
int noCheckNum = Integer.parseInt(String.valueOf(numMap.get("noCheckNum")));
int passNum = Integer.parseInt(String.valueOf(numMap.get("passNum")));
int noPassNum = Integer.parseInt(String.valueOf(numMap.get("noPassNum")));
if(passNum == totalNum){
int dicId = mapper.getDicByMaStatusId("rk_task","入库完成");
mapper.updateTmTaskStatus(dto,dicId);
}else if(noPassNum > 0){
int dicId = mapper.getDicByMaStatusId("rk_task","入库驳回");
mapper.updateTmTaskStatus(dto,dicId);
}
} catch (Exception e) {
//手动回滚异常
@ -118,7 +123,7 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
value = value.add(repairNumValue);
if (Objects.nonNull(num)) {
BigDecimal numValue = new BigDecimal(new Double(String.valueOf(num)).toString());
value.add(numValue);
value = value.add(numValue);
}
return value.doubleValue();
}

View File

@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<set>
<if test="repairNum != null and repairNum != ''">input_num = #{repairNum},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null and updateTime != ''">update_time = #{status},</if>
<if test="updateTime != null and updateTime != ''">update_time = #{updateTime},</if>
<if test="checkType != null and checkType != ''">`status` = #{checkType},</if>
<if test="remark != null and remark != ''">`remark` = #{remark}</if>
</set>
@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<!--更新任务表状态-->
<update id="updateTmTaskStatus">
UPDATE tm_task SET task_status = #{dictId} WHERE task_id = #{params.taskId}
UPDATE tm_task SET task_status = #{dictId},update_by = #{params.updateBy},update_time = #{params.updateTime} WHERE task_id = #{params.taskId}
</update>
<!--获取修试后入库列表-->
@ -85,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
GROUP BY rid.task_id
ORDER BY tt.create_time DESC
</select>
<!--获取修试后入库-详情列表-->
<select id="getRepairedDetailList" resultType="com.bonus.sgzb.material.domain.RepairTestInputDetailVo">
@ -117,6 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INSTR(a.typeName2,#{keyWord}) > 0
)
</if>
<if test="status!=null and status!=''">
AND rid.status = #{status}
</if>
ORDER BY rid.create_time DESC
</select>
<!--查询机具类型-库存数量-->
<select id="getMaTypeByNum" resultType="java.util.Map">