申领单删除逻辑、保养单备件删除BUG解决

highway
wws 12 months ago
parent f221f0ec05
commit c0fd87d2d1

@ -94,7 +94,7 @@ public class EquSpareApplyController extends BaseController {
@Log(title = "申领记录", businessType = BusinessType.DELETE) @Log(title = "申领记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{applyIds}") @DeleteMapping("/{applyIds}")
public AjaxResult remove(@PathVariable String[] applyIds) { public AjaxResult remove(@PathVariable String[] applyIds) {
return toAjax(equSpareApplyService.deleteEquSpareApplyByApplyIds(applyIds)); return equSpareApplyService.deleteEquSpareApplyByApplyIds(applyIds);
} }
/** /**

@ -97,4 +97,11 @@ public interface EquRepairWorkOrderMapper {
//更新维修工单状态 //更新维修工单状态
void updateWorkStatus(String repairCode); void updateWorkStatus(String repairCode);
/**
*
* @param workCode
* @return
*/
EquRepairWorkOrder selectEquRepairWorkOrderByWorkCode(String workCode);
} }

@ -81,4 +81,16 @@ public interface EquSpareApplyMapper {
* @param orderIds * @param orderIds
*/ */
void delEquSpareApplyByorderIds(String[] orderIds); void delEquSpareApplyByorderIds(String[] orderIds);
/**
*
* @param applyIds
*/
void delEquSpareApplyByIds(String[] applyIds);
/**
*
* @param id
*/
void delEquSpareApplyByApplyId(String id);
} }

@ -51,7 +51,7 @@ public interface IEquSpareApplyService {
* @param applyIds * @param applyIds
* @return * @return
*/ */
public int deleteEquSpareApplyByApplyIds(String[] applyIds); public AjaxResult deleteEquSpareApplyByApplyIds(String[] applyIds);
/** /**
* *

@ -371,15 +371,13 @@ public class EquOrderServiceImpl implements IEquOrderService {
return error(500,"工单已进行修改!不可删除!"); return error(500,"工单已进行修改!不可删除!");
} }
if (order.getPlanType().equals("maintenance")) { if (order.getPlanType().equals("maintenance")) {
List<EquSpareApply> applyList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getWorkCode()); List<EquSpareApply> applyList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode());
for (EquSpareApply apply : applyList) { for (EquSpareApply apply : applyList) {
// 返回备件数量 // 返回备件数量
sparePartsLedgerMapper.updateSpareNumAdd(apply); sparePartsLedgerMapper.updateSpareNumAdd(apply);
} }
} }
} }
// 逻辑删除工单
equOrderMapper.delEquOrderByOrderIds(orderIds);
// 逻辑删除获取人员 // 逻辑删除获取人员
equOrderPersonMapper.delEquOrderPersonByorderIds(orderIds); equOrderPersonMapper.delEquOrderPersonByorderIds(orderIds);
// 逻辑删除标准信息 // 逻辑删除标准信息
@ -388,6 +386,8 @@ public class EquOrderServiceImpl implements IEquOrderService {
equOrderDetailMapper.delEquOrderDetailByorderIds(orderIds); equOrderDetailMapper.delEquOrderDetailByorderIds(orderIds);
// 逻辑删除备件信息 // 逻辑删除备件信息
equSpareApplyMapper.delEquSpareApplyByorderIds(orderIds); equSpareApplyMapper.delEquSpareApplyByorderIds(orderIds);
// 逻辑删除工单
equOrderMapper.delEquOrderByOrderIds(orderIds);
return success(); return success();
} }

@ -9,8 +9,11 @@ import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils; import com.op.common.security.utils.SecurityUtils;
import com.op.device.domain.EquOrder;
import com.op.device.domain.EquRepairWorkOrder; import com.op.device.domain.EquRepairWorkOrder;
import com.op.device.domain.SparePartsLedger; import com.op.device.domain.SparePartsLedger;
import com.op.device.mapper.EquOrderMapper;
import com.op.device.mapper.EquRepairWorkOrderMapper;
import com.op.device.mapper.SparePartsLedgerMapper; import com.op.device.mapper.SparePartsLedgerMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -23,6 +26,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.error; import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/** /**
* Service * Service
@ -36,6 +40,10 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
private EquSpareApplyMapper equSpareApplyMapper; private EquSpareApplyMapper equSpareApplyMapper;
@Autowired @Autowired
private SparePartsLedgerMapper sparePartsLedgerMapper; private SparePartsLedgerMapper sparePartsLedgerMapper;
@Autowired
private EquRepairWorkOrderMapper equRepairWorkOrderMapper;
@Autowired
private EquOrderMapper equOrderMapper;
/** /**
* *
@ -80,7 +88,7 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
public AjaxResult insertEquSpareApply(EquSpareApply equSpareApply) { public AjaxResult insertEquSpareApply(EquSpareApply equSpareApply) {
try { try {
//equSpareApply.getSpareApplyLists().size() 是在申领备件的时候进行的操作 //equSpareApply.getSpareApplyLists().size() 是在申领备件的时候进行的操作
if(equSpareApply.getSpareApplyLists().size() >= 1){ if(equSpareApply.getSpareApplyLists().size() >= 1){
List<EquSpareApply> list = equSpareApply.getSpareApplyLists(); List<EquSpareApply> list = equSpareApply.getSpareApplyLists();
for(EquSpareApply applyList:list){ for(EquSpareApply applyList:list){
applyList.setApplyId(IdUtils.fastSimpleUUID()); applyList.setApplyId(IdUtils.fastSimpleUUID());
@ -113,7 +121,7 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
equSpareApply.setCreateBy(SecurityUtils.getUsername()); equSpareApply.setCreateBy(SecurityUtils.getUsername());
equSpareApplyMapper.insertEquSpareApply(equSpareApply); equSpareApplyMapper.insertEquSpareApply(equSpareApply);
} }
return AjaxResult.success("新增申领记录成功!"); return success("新增申领记录成功!");
} catch (Exception e) { } catch (Exception e) {
return error(); return error();
} }
@ -134,15 +142,50 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
} }
/** /**
* * TODO
* *
* @param applyIds * @param applyIds
* @return * @return
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public int deleteEquSpareApplyByApplyIds(String[] applyIds) { public AjaxResult deleteEquSpareApplyByApplyIds(String[] applyIds) {
return equSpareApplyMapper.deleteEquSpareApplyByApplyIds(applyIds); boolean check = true;
// 校验
for (String id : applyIds) {
EquSpareApply apply = equSpareApplyMapper.selectEquSpareApplyByApplyId(id);
if (apply.getWorkCode() != null) {
if (!apply.getWorkCode().isEmpty()) {
EquRepairWorkOrder workOrder = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkCode(apply.getWorkCode());
if (workOrder != null) {
if (workOrder.getWorkStatus().equals("1")) {
check = false;
}
}else {
return error(500,"未查询到对应维修工单信息!删除失败!");
}
EquOrder order = equOrderMapper.selectEquOrderByOrderCode(apply.getWorkCode());
if (order != null) {
if (order.getOrderStatus().equals("1")){
check = false;
}
}else {
return error(500,"未查询到对应保养工单信息!删除失败!");
}
}
}
if (check) {
// 回填数据
sparePartsLedgerMapper.updateSpareNumAdd(apply);
// 逻辑删除领用单
equSpareApplyMapper.delEquSpareApplyByApplyId(id);
}else {
return error(500,"关联工单状态已完成,不可删除!");
}
}
return success();
} }
/** /**

@ -447,7 +447,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where source_id = #{sourceId} where source_id = #{sourceId}
</select> </select>
<insert id="insertBaseFileBatch"> <select id="selectEquRepairWorkOrderByWorkCode" parameterType="EquRepairWorkOrder" resultMap="EquRepairWorkOrderResult">
<include refid="selectEquRepairWorkOrderVo"/>
where work_code = #{workCode} and del_flag = '0'
</select>
<insert id="insertBaseFileBatch">
INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time,image_type) INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time,image_type)
VALUES VALUES
<foreach collection="baseFiles" index="" item="baseFile" separator=","> <foreach collection="baseFiles" index="" item="baseFile" separator=",">

@ -176,6 +176,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) )
</delete> </delete>
<delete id="delEquSpareApplyByIds" parameterType="String">
update equ_spare_apply set del_flag = '1'
where apply_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="delEquSpareApplyByApplyId" parameterType="String">
update equ_spare_apply set del_flag = '1' where apply_id = #{id}
</delete>
<select id="selectRepairSparePartsRecord" parameterType="EquRepairWorkOrder" resultMap="EquSpareApplyResult"> <select id="selectRepairSparePartsRecord" parameterType="EquRepairWorkOrder" resultMap="EquSpareApplyResult">
<include refid="selectEquSpareApplyVo"/> <include refid="selectEquSpareApplyVo"/>
<where> <where>

Loading…
Cancel
Save