同步代码工地直转和退料申请层级

This commit is contained in:
sxu 2024-08-23 13:04:14 +08:00
parent 717362d626
commit 2910295b67
6 changed files with 102 additions and 9 deletions

View File

@ -120,6 +120,12 @@ public interface BackApplyMapper {
*/
List<TypeTreeNode> getUseTypeTree(BackApplyInfo bean);
List<TypeTreeNode> getUseTypeTreeL4(BackApplyInfo bean);
List<TypeTreeNode> getUseTypeTreeL3(List<Long> list);
List<TypeTreeNode> getUseTypeTreeL21(List<Long> list);
/**
* 退料申请导出
* @param bean

View File

@ -44,7 +44,7 @@ public interface WorkSiteDirectManageMapper {
int batchDel(@Param("ids") ArrayList<Integer> ids);
String getMachineStatus(LeaseOutDetails leaseOutDetails);
DirectApplyInfo getMachineStatus(LeaseOutDetails leaseOutDetails);
int updateLeaseApplyDetailsOutNum(@Param("record")LeaseOutDetails leaseOutDetails);

View File

@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author hay
@ -364,8 +365,19 @@ public class BackApplyServiceImpl implements BackApplyService {
public AjaxResult getUseTypeTree(BackApplyInfo bean) {
List<TypeTreeNode> groupList = new ArrayList<>();
List<TypeTreeNode> list = new ArrayList<>();
List<TypeTreeNode> listL4 = new ArrayList<>();
List<TypeTreeNode> listL3 = new ArrayList<>();
List<TypeTreeNode> listL21 = new ArrayList<>();
try {
list = backApplyMapper.getUseTypeTree(bean);
//list = backApplyMapper.getUseTypeTree(bean);
listL4 = backApplyMapper.getUseTypeTreeL4(bean);
List<Long> list4ParentIds = listL4.stream().map(o -> o.getParentId()).collect(Collectors.toList());
listL3 = backApplyMapper.getUseTypeTreeL3(list4ParentIds);
List<Long> list3ParentIds = listL3.stream().map(o -> o.getParentId()).collect(Collectors.toList());
listL21 = backApplyMapper.getUseTypeTreeL21(list3ParentIds);
list.addAll(listL4);
list.addAll(listL3);
list.addAll(listL21);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TypeTreeBuild treeBuild = new TypeTreeBuild(list);

View File

@ -13,7 +13,6 @@ import com.bonus.sgzb.material.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -179,7 +178,7 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
@Transactional(rollbackFor = Exception.class)
public int insertLeaseOutDetail(List<LeaseOutDetails> leaseOutDetails, TmTask lTask) {
int res = 0;
String maStatus = "15";
String maStatus = "16";
double outNum = 0.1;
if (StringUtils.isNull(leaseOutDetails)) {
log.info("领料出库失败,请检查参数是否填写完整!");
@ -187,9 +186,9 @@ public class WorkSiteDirectManageImpl implements WorkSiteDirectManageService {
}
for (LeaseOutDetails leaseOutDetail : leaseOutDetails) {
if (!(Objects.equals(Integer.valueOf(0), leaseOutDetail.getMaId()) || leaseOutDetail.getMaId() == null)) {
String status = workSiteDirectManageMapper.getMachineStatus(leaseOutDetail);
if (!maStatus.equals(status)) {
log.info("领料出库失败,该设备不是在库状态!");
DirectApplyInfo directApplyInfo = workSiteDirectManageMapper.getMachineStatus(leaseOutDetail);
if (!maStatus.equals(directApplyInfo.getStatus())) {
log.info("领料出库失败,该设备不是再用状态!");
return res;
}
}

View File

@ -690,6 +690,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEVEL ASC, type_id;
</select>
<select id="getUseTypeTreeL4" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
SELECT
mt.type_id,
mt.type_name,
mt.parent_id,
mt.unit_name as unitNames,
mt.company_id,
SUM( CASE WHEN sai.agreement_id = #{agreementId} AND sai.STATUS = '0' THEN sai.num ELSE 0 END ) AS num,
mt.LEVEL
FROM
ma_type mt
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
WHERE
EXISTS ( SELECT 1 FROM slt_agreement_info sai2 WHERE sai2.type_id = mt.type_id AND sai2.agreement_id = #{agreementId} AND sai2.STATUS = '0' and sai.lease_type = 0)
GROUP BY
mt.type_id
</select>
<select id="getUseTypeTreeL3" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
SELECT
mt3.type_id,
mt3.type_name,
mt3.parent_id,
mt3.unit_name,
mt3.company_id,
0 AS num,
mt3.LEVEL
FROM
ma_type mt3 where type_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getUseTypeTreeL21" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
SELECT
mt3.type_id,
mt3.type_name,
mt3.parent_id,
mt3.unit_name,
mt3.company_id,
0 AS num,
mt3.LEVEL
FROM
ma_type mt3 where type_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
union
SELECT
mt2.type_id,
mt2.type_name,
mt2.parent_id,
mt2.unit_name,
mt2.company_id,
0 AS num,
mt2.LEVEL
FROM
ma_type mt2 left join (
SELECT
mt3.type_id,
mt3.type_name,
mt3.parent_id,
mt3.unit_name,
mt3.company_id,
0 AS num,
mt3.LEVEL
FROM
ma_type mt3) mt3 on mt3.parent_id=mt2.type_id where mt3.type_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="exportList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
SELECT
bai.`code`,

View File

@ -431,8 +431,8 @@
<select id="getDirectApplyInfoById" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
select * from direct_apply_info where id = #{id}
</select>
<select id="getMachineStatus" resultType="java.lang.String">
select ma_status
<select id="getMachineStatus" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
select ma_status as status
from ma_machine
where ma_id = #{maId}
</select>