领料流程修改

This commit is contained in:
xiaofajia 2024-11-23 17:12:55 +08:00
parent 6c86a132be
commit 15798022e3
3 changed files with 43 additions and 17 deletions

View File

@ -124,4 +124,7 @@ public class DlRepairSo extends TenantBaseDO {
*/
@TableField(exist = false)
private String licenseNumber;
/** 用户记录那些人可以看这条记录 */
private String userIds;
}

View File

@ -50,6 +50,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/**
* 针对表dl_repair_so(采购单领料单)的数据库操作Service实现
@ -218,7 +219,16 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Override
@DSTransactional
public void voidRepairSo(DlRepairSoReqVO repairSoReqVO) {
baseMapper.updateById(repairSoReqVO);
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairSo>()
.set(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode())
.and(i ->
i.eq(DlRepairSo::getId, repairSoReqVO.getId())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.PICKED.getCode())
));
if (update == 0) {
throw exception0(500, "该单据已有其他人操作");
}
// 下面的代码是因为这个接口还有地方在用
// 查主表
@ -325,11 +335,22 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Override
@DSTransactional
public void confirmGet(String id, String image) {
// 更新主表状态 为已领料
DlRepairSo dlRepairSo = new DlRepairSo();
dlRepairSo.setId(id);
dlRepairSo.setSoStatus(SoStatusEnum.PICKED.getCode());
baseMapper.updateById(dlRepairSo);
// 更新主表状态 为已领料 需要判断是否已经领料过了
int update = baseMapper.update(new LambdaUpdateWrapper<DlRepairSo>()
.set(DlRepairSo::getSoStatus, SoStatusEnum.PICKED.getCode())
.and(i -> {
i.eq(DlRepairSo::getId, id)
.ne(DlRepairSo::getSoStatus, SoStatusEnum.PICKED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode());
})
);
if (update == 0) {
throw exception0(500, "该领料单已有其他人操作");
}
// DlRepairSo dlRepairSo = new DlRepairSo();
// dlRepairSo.setId(id);
// dlRepairSo.setSoStatus(SoStatusEnum.PICKED.getCode());
// baseMapper.u
// 查最新的子表信息
DlRepairSo so = baseMapper.selectById(id);

View File

@ -26,6 +26,7 @@
<result property="updater" column="updater" jdbcType="VARCHAR"/>
<result property="twId" column="tw_id" />
<result property="licenseNumber" column="license_number" />
<result property="userIds" column="user_ids" />
</resultMap>
<sql id="Base_SQL">
@ -50,7 +51,8 @@
so.update_time,
so.updater,
so.tw_id,
dtw.license_number
dtw.license_number,
so.user_ids
from dl_repair_so so
LEFT JOIN dl_ticket_wares dtw ON so.tw_id = dtw.id
where so.deleted = '0'
@ -83,7 +85,7 @@
and (so.so_no like concat('%', #{map.soNo}, '%') or so.remark like concat('%', #{map.soNo}, '%'))
</if>
<if test="map.userId != null and map.userId != ''">
and (so.user_id = #{map.userId})
and (so.user_id = #{map.userId} or find_in_set(#{map.userId}, so.user_ids) > 0)
</if>
<if test="map.mainId != null and map.mainId != ''">
and so.main_id = #{map.mainId}