|
|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.xujie.modules.inspection.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
@ -626,4 +627,40 @@ public class InspectionRequestServiceImpl extends ServiceImpl<InspectionRequestH |
|
|
|
|
|
|
|
return baseMapper.queryScheduleView(qcOperator); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void updateRequest(InspectionRequestHeader header) { |
|
|
|
SysUserEntity user = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
String site = user.getSite(); |
|
|
|
|
|
|
|
// 1. 查询头表,校验状态 |
|
|
|
InspectionRequestHeader existingHeader = baseMapper.selectByRequestNo(site, header.getRequestNo()); |
|
|
|
if (existingHeader == null) { |
|
|
|
throw new RuntimeException("检验申请单不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
// 只有草稿状态的验货申请允许修改 |
|
|
|
if (!"Draft".equals(existingHeader.getStatusDb())) { |
|
|
|
throw new RuntimeException("只有草稿状态的验货申请允许修改,当前状态:" + existingHeader.getStatusDb()); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("开始修改验货申请: requestNo={}, site={}", header.getRequestNo(), site); |
|
|
|
|
|
|
|
// 使用UpdateWrapper确保只更新指定字段 |
|
|
|
UpdateWrapper<InspectionRequestHeader> updateWrapper = new UpdateWrapper<>(); |
|
|
|
updateWrapper.eq("site", site) |
|
|
|
.eq("request_no", header.getRequestNo()) |
|
|
|
.set("need_inspect_date", header.getNeedInspectDate()) |
|
|
|
.set("inspect_address", header.getInspectAddress()) |
|
|
|
.set("inspect_contract", header.getInspectContract()); |
|
|
|
|
|
|
|
int updateCount = baseMapper.update(null, updateWrapper); |
|
|
|
|
|
|
|
if (updateCount == 0) { |
|
|
|
throw new RuntimeException("修改验货申请失败"); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("验货申请修改成功: requestNo={}", header.getRequestNo()); |
|
|
|
} |
|
|
|
} |