|
|
@ -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;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询申领记录
|
|
|
|
* 查询申领记录
|
|
|
@ -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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|