|
|
@ -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,10 +40,14 @@ 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;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询申领记录
|
|
|
|
* 查询申领记录
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param applyId 申领记录主键
|
|
|
|
* @param applyId 申领记录主键
|
|
|
|
* @return 申领记录
|
|
|
|
* @return 申领记录
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -51,7 +59,7 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询申领记录列表
|
|
|
|
* 查询申领记录列表
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param equSpareApply 申领记录
|
|
|
|
* @param equSpareApply 申领记录
|
|
|
|
* @return 申领记录
|
|
|
|
* @return 申领记录
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -71,7 +79,7 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 新增申领记录
|
|
|
|
* 新增申领记录
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param equSpareApply 申领记录
|
|
|
|
* @param equSpareApply 申领记录
|
|
|
|
* @return 结果
|
|
|
|
* @return 结果
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -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();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -121,7 +129,7 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 修改申领记录
|
|
|
|
* 修改申领记录
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param equSpareApply 申领记录
|
|
|
|
* @param equSpareApply 申领记录
|
|
|
|
* @return 结果
|
|
|
|
* @return 结果
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -134,20 +142,55 @@ 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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 删除申领记录信息
|
|
|
|
* 删除申领记录信息
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param applyId 申领记录主键
|
|
|
|
* @param applyId 申领记录主键
|
|
|
|
* @return 结果
|
|
|
|
* @return 结果
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|