This commit is contained in:
hayu 2025-09-23 20:32:54 +08:00
parent fd650d2f3c
commit 9dab95e001
4 changed files with 38 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Author ma_sh
@ -71,6 +72,8 @@ public class MaCodeVo {
@ApiModelProperty(value = "协议ID")
private Long agreementId;
private List<String> agreementIds;
private String createBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -243,4 +243,8 @@ public interface MaterialBackInfoMapper {
* @return
*/
List<MaCodeVo> getMachine(MaterialBackApplyInfo dto);
MaterialBackApplyInfo getAgreementInfo(MaterialBackApplyInfo backApplyInfo);
List<String> getAgreementList(MaterialBackApplyInfo agreement);
}

View File

@ -296,6 +296,12 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
MaterialBackApplyRequestVo backApplyRequestVo = new MaterialBackApplyRequestVo();
//先根据外层id查询上层信息
MaterialBackApplyInfo backApplyInfo = materialBackInfoMapper.selectBackApplyInfoById(id);
//根据退料任务查询班组id和工程id然后查询协议集合
MaterialBackApplyInfo agreement = materialBackInfoMapper.getAgreementInfo(backApplyInfo);
List<String> list = materialBackInfoMapper.getAgreementList(agreement);
backApplyInfo.setAgreementIds(list);
if (StringUtils.isNotBlank(backApplyInfo.getBackSignUrl())) {
if (!backApplyInfo.getBackSignUrl().startsWith("http")) {
backApplyInfo.setBackSignUrl("data:image/png;base64," + backApplyInfo.getBackSignUrl());
@ -314,11 +320,12 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
List<MaCodeVo> maCodeList = fetchMaCodeList(id);
if ("0".equals(backApplyInfo.getStatus())) {
if (CollectionUtils.isNotEmpty(maCodeList)) {
// 根据id查询协议id
Long agreementId = materialBackInfoMapper.selectAgreementId(backApplyInfo);
// // 根据id查询协议id
// Long agreementId = materialBackInfoMapper.selectAgreementId(backApplyInfo);
for (MaCodeVo maCodeVo : maCodeList) {
if (maCodeVo.getMaId() != null) {
maCodeVo.setAgreementId(agreementId);
// maCodeVo.setAgreementId(agreementId);
maCodeVo.setAgreementIds(backApplyInfo.getAgreementIds());
// 根据协议id以及typeIdmaId查询设备是否还在用
MaterialBackApplyInfo info1 = materialBackInfoMapper.selectByAgreementIdAndTypeId(maCodeVo);
if (info1 == null) {

View File

@ -813,14 +813,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectByAgreementIdAndTypeId" resultType="com.bonus.material.clz.domain.back.MaterialBackApplyInfo">
SELECT
agreement_id AS agreementId,
type_id AS typeId,
ma_id AS maId
FROM
clz_slt_agreement_info
WHERE
status = '0'
AND agreement_id = #{agreementId}
<if test="agreementIds != null ">
and agreement_id in
<foreach item="item" collection="agreementIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND type_id = #{typeId}
<if test="maId != null">
AND ma_id = #{maId}
@ -869,5 +873,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mm.qr_code = #{qrCode}
</if>
</select>
<select id="getAgreementInfo" resultType="com.bonus.material.clz.domain.back.MaterialBackApplyInfo">
select
csa.unit_id AS teamId,
csa.project_id AS proId
from
tm_task_agreement tta
LEFT JOIN clz_bm_agreement_info csa ON tta.agreement_id = csa.agreement_id
WHERE tta.task_id = #{taskId}
</select>
<select id="getAgreementList" resultType="java.lang.String">
select csa.agreement_id AS agreementId
from clz_bm_agreement_info csa
where csa.unit_id = #{teamId}
and csa.project_id = #{proId}
</select>
</mapper>