退料申请表数据问题修改

This commit is contained in:
liang.chao 2024-03-21 09:06:12 +08:00
parent bd3fad2270
commit 929673e491
3 changed files with 18 additions and 91 deletions

View File

@ -108,13 +108,7 @@ public class PurchaseMacodeInfoController extends BaseController {
@ApiOperation(value = "修改编码管理的入库状态")
@PutMapping("/manageStatus")
public AjaxResult modifyManageStatus(@RequestBody MaInputVO maInputVO) throws Exception {
int res = purchaseMacodeInfoService.modifyManageStatus(maInputVO);
if (res == 0) {
return AjaxResult.error("入库单存在未绑定编码或无法绑定编码的设备,出库失败");
} else {
return AjaxResult.success();
}
return toAjax(purchaseMacodeInfoService.modifyManageStatus(maInputVO));
}
/**

View File

@ -18,7 +18,6 @@ import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.material.vo.EquipmentNumberVO;
import com.bonus.sgzb.material.vo.GlobalContants;
import com.bonus.sgzb.material.vo.MaInputVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,7 +45,6 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
private PurchaseCheckDetailsMapper checkDetailsMapper;
/**
* 查询新购验收编号管理
*
@ -274,22 +272,16 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
String checkResult = maInputVO.getCheckResult();
List<MaInputRecord> inputRecordList = maInputVO.getInputRecordList();
for (MaInputRecord maInputRecord : inputRecordList) {
PurchaseMacodeInfo purchaseMacodeInfo = new PurchaseMacodeInfo();
purchaseMacodeInfo.setTaskId(taskId);
Long typeId = maInputRecord.getTypeId();
purchaseMacodeInfo.setTypeId(typeId);
List<PurchaseMacodeInfo> purchaseMacodeInfos = selectPutinDetailsAddTypeId(purchaseMacodeInfo);
for (PurchaseMacodeInfo macodeInfo : purchaseMacodeInfos) {
if (macodeInfo.getMaCode() == null) {
return 0;
}
}
// 修改机具入库状态
MaMachine maMachine = new MaMachine();
maMachine.setMaId(maInputRecord.getMaId());
maMachine.setMaCode(maInputRecord.getMaCode());
//修改编码管理表入库状态
PurchaseMacodeInfo purchaseMacodeInfo = new PurchaseMacodeInfo();
purchaseMacodeInfo.setTaskId(taskId);
purchaseMacodeInfo.setTypeId(typeId);
purchaseMacodeInfo.setMaCode(maInputRecord.getMaCode());
// 修改验收任务详细表入库数量
@ -359,10 +351,6 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
return 1;
}
private List<PurchaseMacodeInfo> selectPutinDetailsAddTypeId(PurchaseMacodeInfo purchaseMacodeInfo) {
return purchaseMacodeInfoMapper.selectPutinDetailsAddTypeId(purchaseMacodeInfo);
}
/**
* 根据机具编码删除编码

View File

@ -484,77 +484,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<select id="getUseTypeTree" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
WITH RECURSIVE cte AS (
SELECT
mt.type_id,
mt.parent_id,
mt.type_name,
mt.`level`,
mt.unit_name,
mt4.num,
mt4.company_id
mt.type_id AS typeId,
mt.type_name AS typeName,
mt.parent_id AS parentId,
mt.unit_name AS unitNames,
mt.company_id AS companyId,
IFNULL(aa.num,0) as num,
mt.`level`
FROM
ma_type mt
LEFT JOIN (
SELECT
subquery1.type_id AS typeId,
subquery1.parent_id ,
subquery1.typeName typeCode,
subquery1.out_num - COALESCE ( subquery2.audit_num, 0 ) AS num,
subquery1.company_id
FROM
(-- 第一个查询作为子查询
SELECT
mt.type_id,
mt.parent_id,
mt.type_name AS typeName,
mt.company_id,
SUM( lod.out_num ) AS out_num
FROM
lease_apply_info lai
LEFT JOIN tm_task_agreement tta ON lai.task_id = tta.task_id
LEFT JOIN lease_out_details lod ON lod.parent_id = lai.id
LEFT JOIN tm_task tt ON tt.task_id = tta.task_id
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
LEFT JOIN ( SELECT SUM(sai.num)as num,sai.type_id FROM slt_agreement_info sai WHERE sai.`status`='0'
<if test="agreementId!=null and agreementId!=''">
and sai.agreement_id =#{agreementId}
</if>
GROUP BY sai.type_id) aa on aa.type_id=mt.type_id
WHERE
tta.agreement_id = #{agreementId}
AND tt.task_type = '29'
AND mt.`level` = '4'
GROUP BY
mt.type_id
) AS subquery1
LEFT JOIN (-- 第二个查询作为子查询
SELECT
mt.type_id,
mt.parent_id,
mt.type_name,
mt.company_id,
SUM( bad.audit_num ) AS audit_num
FROM
back_apply_info bai
LEFT JOIN tm_task tt ON tt.task_id = bai.task_id
LEFT JOIN back_apply_details bad ON bad.parent_id = bai.id
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
LEFT JOIN ma_type mt ON mt.type_id = bad.type_id
WHERE
tta.agreement_id = #{agreementId}
AND tt.task_type = '36'
AND mt.`level` = '4'
GROUP BY
mt.type_id
) AS subquery2 ON subquery1.type_id = subquery2.type_id
) mt4 on mt4.typeId = mt.type_id
HAVING num is not null
UNION ALL
SELECT ma_type.type_id, ma_type.parent_id,ma_type.type_name as typeCode, ma_type.`level`,ma_type.unit_name,0 as
num,ma_type.company_id
FROM ma_type
JOIN cte ON ma_type.type_id = cte.parent_id
)
SELECT type_id as typeId, parent_id as parentId,type_name as typeName,num,`level`,unit_name as unitNames,company_id as companyId
FROM cte
WHERE
1=1
mt.del_flag = '0'
<if test="level!=null and level!=''">
<if test="level == 2">
AND level IN ('1','2')
@ -566,8 +513,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND level IN ('1','2','3','4')
</if>
</if>
GROUP BY type_id
ORDER BY type_id
</select>
<select id="exportList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">