问题修改

This commit is contained in:
jiang 2025-11-16 18:11:01 +08:00
parent 2eed453e53
commit 9a59617c3a
3 changed files with 38 additions and 0 deletions

View File

@ -261,4 +261,6 @@ public interface DevChangeMapper {
void updateGj(CsDeviceDetails entity);
void updateZb(CsDeviceDetails entity);
List<CsDeviceDetails> getOutAllList(CsDeviceDetails dto);
}

View File

@ -513,7 +513,19 @@ public class DevChangeServiceImpl implements DevChangeService {
public AjaxResult outAll(CsDeviceDetails entity) {
try {
List<CsDeviceDetails> outAllList = mapper.getOutAllList(entity);
Integer out = mapper.outAll(entity);
if (out > 0) {
outAllList.forEach(item -> {
if (item.getDevType().equals("1")) {
mapper.updateZb(item);
} else {
mapper.updateGj(item);
}
});
}
return out > 0 ? AjaxResult.success("出库成功") : AjaxResult.error("出库失败");
} catch (Exception e) {
log.error(e.getMessage());

View File

@ -544,6 +544,30 @@
ORDER BY temp.createTime
DESC
</select>
<select id="getOutAllList" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
SELECT COALESCE(
CASE
WHEN cdcd.dev_type = '1' THEN CONCAT(a.ma_id, '')
WHEN cdcd.dev_type = '2' THEN CONCAT(b.id, '')
ELSE ''
END, ''
) AS id,
cdcd.dev_type AS devType,
COALESCE(cdcd.num, 0) - COALESCE(cdcd.real_num, 0) AS outNum
FROM cs_device_change_details cdcd
LEFT JOIN ma_dev_info a
ON cdcd.dev_type = '1'
AND cdcd.dev_code = a.`code`
LEFT JOIN tool_ledger b
ON cdcd.dev_type = '2'
AND cdcd.dev_type_id = b.type_id
AND (cdcd.dev_code = '/' OR cdcd.dev_code = b.tool_code)
WHERE cdcd.del_flag = 0
AND cdcd.dev_type IN ('1', '2')
AND cdcd.change_id = #{id}
</select>
<insert id="addChangeInfoNew" keyProperty="id" useGeneratedKeys="true">
insert into cs_device_change(change_status, type, lease_type, pro_code, pro_name,