退料审核代码提交

This commit is contained in:
liang.chao 2024-05-06 17:07:03 +08:00
parent 52745e9a4e
commit 0cce5cc793
5 changed files with 72 additions and 8 deletions

View File

@ -186,4 +186,16 @@ public class BackApplyInfo {
private String endTime; private String endTime;
private Integer flag; private Integer flag;
private Integer partNum; private Integer partNum;
/**
* 合格数量
*/
private Integer hgNum;
/**
* 维修数量
*/
private Integer wxNum;
/**
* 报废数量
*/
private Integer bfNum;
} }

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.BackApplyInfo; import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.BmAgreementInfo; import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.domain.TmTask;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -52,4 +53,8 @@ public interface BackApplyAppMapper {
int refuse(BackApplyInfo record); int refuse(BackApplyInfo record);
int updateTmTask(BackApplyInfo record); int updateTmTask(BackApplyInfo record);
List<TmTask> getMaTypeDetails(BackApplyInfo backApplyInfo);
MachinePart getMachineParts(TmTask typeId);
} }

View File

@ -3,11 +3,13 @@ package com.bonus.sgzb.app.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.app.domain.BackApplyInfo; import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.BmAgreementInfo; import com.bonus.sgzb.app.domain.BmAgreementInfo;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.mapper.BackApplyAppMapper; import com.bonus.sgzb.app.mapper.BackApplyAppMapper;
import com.bonus.sgzb.app.service.BackApplyService; import com.bonus.sgzb.app.service.BackApplyService;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -112,7 +114,27 @@ public class BackApplyServiceImpl implements BackApplyService {
@Override @Override
public List<BackApplyInfo> examineView(BackApplyInfo record) { public List<BackApplyInfo> examineView(BackApplyInfo record) {
return backApplyMapper.examineView(record); List<BackApplyInfo> backApplyInfoList = backApplyMapper.examineView(record);
return getMaTypeDetails(backApplyInfoList);
}
private List<BackApplyInfo> getMaTypeDetails(List<BackApplyInfo> view) {
if (view.size() > 0) {
for (BackApplyInfo backApplyInfo : view) {
if ("2".equals(backApplyInfo.getManageType())) {
List<MachinePart> machineParts = new ArrayList<>();
List<TmTask> typeIds = backApplyMapper.getMaTypeDetails(backApplyInfo);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = backApplyMapper.getMachineParts(typeId);
machinePart.setPartNum((typeId.getPartNum() * Double.parseDouble(backApplyInfo.getPreNum())));
machineParts.add(machinePart);
}
backApplyInfo.setMaTypeDetails(machineParts);
}
}
}
return view;
} }
@Override @Override
@ -124,11 +146,11 @@ public class BackApplyServiceImpl implements BackApplyService {
record.setCreateBy(userId); record.setCreateBy(userId);
if (roles.contains("jjfgs") || roles.contains("admin")) { if (roles.contains("jjfgs") || roles.contains("admin")) {
record.setStatus("1"); record.setStatus("1");
backApplyMapper.audit(record); backApplyMapper.audit(record);
} }
if (roles.contains("tsfgs") || roles.contains("admin")) { if (roles.contains("tsfgs") || roles.contains("admin")) {
record.setStatus("3"); record.setStatus("3");
backApplyMapper.audit(record); backApplyMapper.audit(record);
} }
List<Integer> taskIdById = backApplyMapper.getTaskIdById(record); List<Integer> taskIdById = backApplyMapper.getTaskIdById(record);
if (CollUtil.isNotEmpty(taskIdById)) { if (CollUtil.isNotEmpty(taskIdById)) {

View File

@ -466,7 +466,7 @@
GROUP_CONCAT(bai.company_id) as companyId, GROUP_CONCAT(bai.company_id) as companyId,
GROUP_CONCAT(DISTINCT bad.type_id) as typeId, GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
GROUP_CONCAT(CONCAT_WS('/', IFNULL(mt2.type_name, ''))) AS typeName, GROUP_CONCAT(CONCAT_WS('/', IFNULL(mt2.type_name, ''))) AS typeName,
SUM(DISTINCT bad.pre_num) AS num, SUM(bad.pre_num) AS num,
bai.direct_audit_remark as directAuditRemark bai.direct_audit_remark as directAuditRemark
FROM FROM
back_apply_info bai back_apply_info bai
@ -488,6 +488,9 @@
SELECT SELECT
mt.type_name typeCode, mt.type_name typeCode,
CONCAT_WS('/', IFNULL(mt2.type_name, '')) AS typeName, CONCAT_WS('/', IFNULL(mt2.type_name, '')) AS typeName,
bad.type_id as typeId,
mt.manage_type as manageType,
bad.pre_num as preNum,
bad.pre_num as num bad.pre_num as num
FROM FROM
back_apply_details bad back_apply_details bad
@ -511,6 +514,27 @@
(SELECT * FROM back_apply_info bai2 WHERE bai2.id = #{id}) dd (SELECT * FROM back_apply_info bai2 WHERE bai2.id = #{id}) dd
on bai1.task_id = dd.task_id on bai1.task_id = dd.task_id
</select> </select>
<select id="getMaTypeDetails" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
mws2.type_id AS typeId,
mws2.part_num AS partNum
FROM
ma_type mt1
LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
WHERE
mt1.type_id = #{typeId}
</select>
<select id="getMachineParts" resultType="com.bonus.sgzb.app.domain.MachinePart">
SELECT
mt.type_name AS typeModelName,
mt.unit_name as unitName,
m2.type_name As typeName
FROM
ma_type mt
LEFT JOIN ma_type m2 ON mt.parent_id = m2.type_id
WHERE
mt.type_id = #{typeId}
</select>
</mapper> </mapper>

View File

@ -621,8 +621,7 @@
WHERE WHERE
tt.task_status IN ( 37, 38, 39, 40 ) tt.task_status IN ( 37, 38, 39, 40 )
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
and (bai.code like concat('%', #{keyWord}, '%') or and bai.code like concat('%', #{keyWord}, '%')
bagi.agreement_code like concat('%', #{keyWord}, '%'))
</if> </if>
<if test="unitId != null and unitId != ''"> <if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId} and bui.unit_id = #{unitId}
@ -964,8 +963,10 @@
SELECT SELECT
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt1.type_name AS typeCode, mt1.type_name AS typeCode,
ifnull(sum( bcd.back_num ), 0) AS backNum, SUM( CASE WHEN bcd.back_status = 1 THEN bcd.back_num ELSE 0 END ) AS hgNum,
mm.ma_code as maCode, SUM( CASE WHEN bcd.back_status = 2 THEN bcd.back_num ELSE 0 END ) AS wxNum,
SUM( CASE WHEN bcd.back_status = 3 THEN bcd.back_num ELSE 0 END ) AS bfNum,
mm.ma_code AS maCode,
bcd.create_time AS backTime, bcd.create_time AS backTime,
bcd.type_id as modelId, bcd.type_id as modelId,
bcd.back_status AS backStatus bcd.back_status AS backStatus