|
|
|
@ -15,6 +15,7 @@ import com.op.device.service.IDevicePDAService;
|
|
|
|
|
import com.op.system.api.domain.SysUser;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
@ -66,6 +67,11 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private SparePartsLedgerMapper sparePartsLedgerMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquipmentMapper equipmentMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquOperationRecordMapper equOperationRecordMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取今日巡检任务工单list-状态不为已完成
|
|
|
|
@ -115,7 +121,13 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
timeArray.add(order.getOrderEnd());
|
|
|
|
|
order.setTimeArray(timeArray);
|
|
|
|
|
|
|
|
|
|
order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(order.getOrderCode()));
|
|
|
|
|
String planName = equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode());
|
|
|
|
|
if (planName != null) {
|
|
|
|
|
order.setPlanName(planName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设备名称
|
|
|
|
|
order.setEquipmentName(equipmentMapper.selectEquipmentByEquipmentCode(order.getEquipmentCode()).getEquipmentName());
|
|
|
|
|
|
|
|
|
|
order.setWorkCenterName(equOrderMapper.selectCenterNameByCenterCode(order.getPlanWorkshop()));
|
|
|
|
|
|
|
|
|
@ -155,7 +167,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
|
|
|
|
|
// 保养图片
|
|
|
|
|
BaseFileData selectTemp = new BaseFileData();
|
|
|
|
|
selectTemp.setSourceId(equOrder.getId());
|
|
|
|
|
selectTemp.setSourceId(order.getOrderId());
|
|
|
|
|
List<String> upkeepPictures = equFileMapper.selectUrlList(selectTemp);
|
|
|
|
|
if (upkeepPictures != null) {
|
|
|
|
|
order.setUpkeepPictures(upkeepPictures);
|
|
|
|
@ -244,6 +256,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
|
|
|
|
|
// 更新工单信息
|
|
|
|
|
equOrder.setOrderStatus("1"); // 状态为已完成
|
|
|
|
|
equOrder.setOrderStart(DateUtils.getNowDate());// 设置检查时间
|
|
|
|
|
equOrder.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
equOrder.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
|
|
|
|
@ -319,6 +332,17 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
if (maintenanceFlag) {
|
|
|
|
|
// 设置结束时间
|
|
|
|
|
equOrder.setOrderEnd(DateUtils.getNowDate());
|
|
|
|
|
// 设置保养用时
|
|
|
|
|
long diff = equOrder.getOrderEnd().getTime() - equOrder.getOrderStart().getTime();
|
|
|
|
|
equOrder.setOrderCostTime(String.valueOf(diff/60000));
|
|
|
|
|
// 创建设备对象用于更新设备状态
|
|
|
|
|
Equipment equ = new Equipment();
|
|
|
|
|
equ.setEquipmentCode(equOrder.getEquipmentCode());
|
|
|
|
|
// 更新设备状态为正常运行
|
|
|
|
|
equ.setStatus("1");
|
|
|
|
|
equOrderMapper.updateEquipmentStatus(equ);
|
|
|
|
|
// 更新设备运行记录
|
|
|
|
|
updateOperationRecord(equOrder.getEquipmentCode(),"on","");
|
|
|
|
|
//上传附件
|
|
|
|
|
if (StringUtils.isNotEmpty(equOrder.getPicturePath())) {
|
|
|
|
|
String[] ids = equOrder.getPicturePath().split(",");
|
|
|
|
@ -436,7 +460,6 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 开始保养任务
|
|
|
|
|
* TODO 修改设备状态
|
|
|
|
|
*
|
|
|
|
|
* @param pdadto
|
|
|
|
|
* @return
|
|
|
|
@ -449,6 +472,25 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
order.setOrderStatus("3");
|
|
|
|
|
// 设置是否停机保养
|
|
|
|
|
order.setShutDown(pdadto.getShutDown());
|
|
|
|
|
// 创建设备对象用于更新设备状态
|
|
|
|
|
Equipment equ = new Equipment();
|
|
|
|
|
equ.setEquipmentCode(order.getEquipmentCode());
|
|
|
|
|
// 运行记录类型
|
|
|
|
|
String operationType;
|
|
|
|
|
// 停机保养
|
|
|
|
|
if (pdadto.getShutDown().equals("1")){
|
|
|
|
|
operationType = "off";
|
|
|
|
|
}else {
|
|
|
|
|
operationType = "on";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 更改设备状态为保养中
|
|
|
|
|
equ.setStatus("3");
|
|
|
|
|
equOrderMapper.updateEquipmentStatus(equ);
|
|
|
|
|
|
|
|
|
|
// 更新设备运行记录
|
|
|
|
|
updateOperationRecord(order.getEquipmentCode(),operationType,"upkeep");
|
|
|
|
|
|
|
|
|
|
// 设置开始时间
|
|
|
|
|
order.setOrderStart(DateUtils.getNowDate());
|
|
|
|
|
// 设置保养人
|
|
|
|
@ -531,14 +573,23 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
//维修中
|
|
|
|
|
equRepairWorkOrder.setWorkStatus("2");
|
|
|
|
|
//维修工单里面的设备名 简化TODO
|
|
|
|
|
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
//修改设备状态 改为维修中
|
|
|
|
|
EquEquipment equEquipment = new EquEquipment();
|
|
|
|
|
equEquipment.setEquipmentCode(list.getEquipmentCode());
|
|
|
|
|
equEquipment.setEquipmentStatus("2");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
|
|
|
|
|
equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder);
|
|
|
|
|
return success("提交成功,开始维修!");
|
|
|
|
|
return success("提交成功,设备开始维修!");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return error();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询设备
|
|
|
|
|
* @param equipmentId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -577,7 +628,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
List<EquOrderStandard> standardLists = equOrderStandardMapper.selectPdaEquOrderList(equOrderStandard);
|
|
|
|
|
for (EquOrderStandard standardList : standardLists) {
|
|
|
|
|
//每个检查标准里面的照片
|
|
|
|
|
List<BaseFileData> files = equOrderStandardMapper.getBaseFileBatch(standardList.getId());
|
|
|
|
|
String imageType = "4";
|
|
|
|
|
List<BaseFileData> files = equOrderStandardMapper.getBaseFileBatch(standardList.getId(),imageType);
|
|
|
|
|
if (!CollectionUtils.isEmpty(files)) {
|
|
|
|
|
standardList.setPicturePaths(files);
|
|
|
|
|
}
|
|
|
|
@ -611,117 +663,149 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
* @param equRepairWorkOrder
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Transactional//增加事务注解,出错时自动回滚
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) {
|
|
|
|
|
//判断是否停机
|
|
|
|
|
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
if (list.getWorkDownMachine().equals("1")) {
|
|
|
|
|
//维修结束时间、维修真正停机时间
|
|
|
|
|
equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate());
|
|
|
|
|
}
|
|
|
|
|
equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate());
|
|
|
|
|
//更新每一项点检/巡检检查项信息
|
|
|
|
|
List<EquOrder> checkLists = equRepairWorkOrder.getDetailList();
|
|
|
|
|
for (EquOrder checkList : checkLists) {
|
|
|
|
|
checkList.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
checkList.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
List<EquOrderStandard> standardLists = checkList.getStandardList();
|
|
|
|
|
for (EquOrderStandard standardList : standardLists) {
|
|
|
|
|
//先删除每个检查项标准图片
|
|
|
|
|
equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId());
|
|
|
|
|
//图片
|
|
|
|
|
if (StringUtils.isNotEmpty(standardList.getPicturePath())) {
|
|
|
|
|
String[] ids = standardList.getPicturePath().split(",");
|
|
|
|
|
List<BaseFileData> files = new ArrayList<>();
|
|
|
|
|
BaseFileData file = null;
|
|
|
|
|
for (String id : ids) {
|
|
|
|
|
file = new BaseFileData();
|
|
|
|
|
file.setFileId(IdUtils.fastSimpleUUID());
|
|
|
|
|
file.setFileName(id.split("&fileName=")[1]);
|
|
|
|
|
file.setFileAddress(id);
|
|
|
|
|
file.setSourceId(standardList.getId());
|
|
|
|
|
file.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
file.setCreateTime(new Date());
|
|
|
|
|
//维修后
|
|
|
|
|
file.setImageType("4");
|
|
|
|
|
files.add(file);
|
|
|
|
|
// try {
|
|
|
|
|
//判断是否停机
|
|
|
|
|
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
if (list.getWorkDownMachine().equals("1")) {
|
|
|
|
|
//维修真正停机时间
|
|
|
|
|
equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate());
|
|
|
|
|
}
|
|
|
|
|
//维修工单结束时间
|
|
|
|
|
equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate());
|
|
|
|
|
|
|
|
|
|
////更新每一项点检/巡检检查项信息
|
|
|
|
|
//判空
|
|
|
|
|
if(StringUtils.isNotEmpty(equRepairWorkOrder.getDetailList())){
|
|
|
|
|
List<EquOrder> checkLists = equRepairWorkOrder.getDetailList();
|
|
|
|
|
for (EquOrder checkList : checkLists) {
|
|
|
|
|
checkList.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
checkList.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
List<EquOrderStandard> standardLists = checkList.getStandardList();
|
|
|
|
|
for (EquOrderStandard standardList : standardLists) {
|
|
|
|
|
//先删除每个检查项标准图片
|
|
|
|
|
String imageType = "4";
|
|
|
|
|
equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId(),imageType);
|
|
|
|
|
//图片批量新增
|
|
|
|
|
if (StringUtils.isNotEmpty(standardList.getPicturePath())) {
|
|
|
|
|
String[] ids = standardList.getPicturePath().split(",");
|
|
|
|
|
List<BaseFileData> files = new ArrayList<>();
|
|
|
|
|
BaseFileData file = null;
|
|
|
|
|
for (String id : ids) {
|
|
|
|
|
file = new BaseFileData();
|
|
|
|
|
file.setFileId(IdUtils.fastSimpleUUID());
|
|
|
|
|
file.setFileName(id.split("&fileName=")[1]);
|
|
|
|
|
file.setFileAddress(id);
|
|
|
|
|
file.setSourceId(standardList.getId());
|
|
|
|
|
file.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
file.setCreateTime(new Date());
|
|
|
|
|
//图片类型 维修后
|
|
|
|
|
file.setImageType("4");
|
|
|
|
|
files.add(file);
|
|
|
|
|
}
|
|
|
|
|
equOrderStandardMapper.insertBaseFileBatch(files);
|
|
|
|
|
}
|
|
|
|
|
standardList.setRepairReach(standardList.getDetailReach());
|
|
|
|
|
standardList.setRepairValue(standardList.getActualValue());
|
|
|
|
|
standardList.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
standardList.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
equOrderStandardMapper.updateActualValues(standardList);
|
|
|
|
|
}
|
|
|
|
|
equOrderStandardMapper.insertBaseFileBatch(files);
|
|
|
|
|
equOrderMapper.updateEquOrder(checkList);
|
|
|
|
|
}
|
|
|
|
|
standardList.setRepairReach(standardList.getDetailReach());
|
|
|
|
|
standardList.setRepairValue(standardList.getActualValue());
|
|
|
|
|
standardList.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
standardList.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
equOrderStandardMapper.updateActualValues(standardList);
|
|
|
|
|
}
|
|
|
|
|
equOrderMapper.updateEquOrder(checkList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//新建申领单
|
|
|
|
|
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
|
|
|
|
|
for (EquSpareApply equSpareApply : equSpareApplies) {
|
|
|
|
|
//生成领料单code
|
|
|
|
|
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
|
|
|
|
|
String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10);
|
|
|
|
|
//十五位单号
|
|
|
|
|
equSpareApply.setApplyCode("AW" + code + serialNum);
|
|
|
|
|
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
|
|
|
|
|
//备品备件规格型号!!!!!
|
|
|
|
|
// equSpareApply.setSpareModel(equSpareApply.getS);
|
|
|
|
|
equSpareApply.setSpareCode(equSpareApply.getMaterialCode());
|
|
|
|
|
equSpareApply.setSpareName(equSpareApply.getMaterialDesc());
|
|
|
|
|
equSpareApply.setApplyPeople(SecurityUtils.getUsername());
|
|
|
|
|
equSpareApply.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
equSpareApply.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
equSpareApply.setApplyTime(DateUtils.getNowDate());
|
|
|
|
|
equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode());
|
|
|
|
|
equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode());
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
|
|
|
|
|
equSpareApplyMapper.insertEquSpareApply(equSpareApply);
|
|
|
|
|
|
|
|
|
|
//更新完备品申领单后,更新库存
|
|
|
|
|
SparePartsLedger sparePartsLedger = new SparePartsLedger();
|
|
|
|
|
sparePartsLedger.setStorageId(equSpareApply.getStorageId());
|
|
|
|
|
BigDecimal applyNum = equSpareApply.getSpareQuantity();
|
|
|
|
|
BigDecimal amount = equSpareApply.getAmount();
|
|
|
|
|
sparePartsLedger.setAmount(amount.subtract(applyNum));
|
|
|
|
|
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
|
|
|
|
|
}
|
|
|
|
|
////新建申领单
|
|
|
|
|
//判空
|
|
|
|
|
if(StringUtils.isNotEmpty(equRepairWorkOrder.getApplyList())){
|
|
|
|
|
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
|
|
|
|
|
for (EquSpareApply equSpareApply : equSpareApplies) {
|
|
|
|
|
//生成领料单code
|
|
|
|
|
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
|
|
|
|
|
String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10);
|
|
|
|
|
//十五位单号
|
|
|
|
|
equSpareApply.setApplyCode("AW" + code + serialNum);
|
|
|
|
|
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
|
|
|
|
|
//备品备件规格型号!!!!!
|
|
|
|
|
//equSpareApply.setSpareModel(equSpareApply.getSpareMode());
|
|
|
|
|
//备件编码
|
|
|
|
|
equSpareApply.setSpareCode(equSpareApply.getMaterialCode());
|
|
|
|
|
//备件名称
|
|
|
|
|
equSpareApply.setSpareName(equSpareApply.getMaterialDesc());
|
|
|
|
|
//申领人
|
|
|
|
|
equSpareApply.setApplyPeople(SecurityUtils.getUsername());
|
|
|
|
|
equSpareApply.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
equSpareApply.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
//申领时间
|
|
|
|
|
equSpareApply.setApplyTime(DateUtils.getNowDate());
|
|
|
|
|
//使用设备
|
|
|
|
|
equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode());
|
|
|
|
|
//关联维修工单号
|
|
|
|
|
equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode());
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
//工厂号
|
|
|
|
|
equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
|
|
|
|
|
equSpareApplyMapper.insertEquSpareApply(equSpareApply);
|
|
|
|
|
|
|
|
|
|
////更新完备品申领单后,更新库存
|
|
|
|
|
SparePartsLedger sparePartsLedger = new SparePartsLedger();
|
|
|
|
|
sparePartsLedger.setStorageId(equSpareApply.getStorageId());
|
|
|
|
|
BigDecimal applyNum = equSpareApply.getSpareQuantity();
|
|
|
|
|
BigDecimal amount = equSpareApply.getAmount();
|
|
|
|
|
//减去库存
|
|
|
|
|
sparePartsLedger.setAmount(amount.subtract(applyNum));
|
|
|
|
|
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//图片
|
|
|
|
|
//先删除每个维修工单对应图片
|
|
|
|
|
equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) {
|
|
|
|
|
String[] ids = equRepairWorkOrder.getFileList().split(",");
|
|
|
|
|
List<BaseFileData> files = new ArrayList<>();
|
|
|
|
|
BaseFileData file = null;
|
|
|
|
|
for (String id : ids) {
|
|
|
|
|
file = new BaseFileData();
|
|
|
|
|
file.setFileId(IdUtils.fastSimpleUUID());
|
|
|
|
|
file.setFileName(id.split("&fileName=")[1]);
|
|
|
|
|
file.setFileAddress(id);
|
|
|
|
|
file.setSourceId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
file.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
file.setCreateTime(new Date());
|
|
|
|
|
//维修后
|
|
|
|
|
file.setImageType("4");
|
|
|
|
|
files.add(file);
|
|
|
|
|
////增加多个维修后照片
|
|
|
|
|
//先删除每个维修工单对应图片
|
|
|
|
|
equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) {
|
|
|
|
|
String[] ids = equRepairWorkOrder.getFileList().split(",");
|
|
|
|
|
List<BaseFileData> files = new ArrayList<>();
|
|
|
|
|
BaseFileData file = null;
|
|
|
|
|
for (String id : ids) {
|
|
|
|
|
file = new BaseFileData();
|
|
|
|
|
file.setFileId(IdUtils.fastSimpleUUID());
|
|
|
|
|
file.setFileName(id.split("&fileName=")[1]);
|
|
|
|
|
file.setFileAddress(id);
|
|
|
|
|
file.setSourceId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
file.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
file.setCreateTime(new Date());
|
|
|
|
|
//维修后
|
|
|
|
|
file.setImageType("4");
|
|
|
|
|
files.add(file);
|
|
|
|
|
}
|
|
|
|
|
equRepairWorkOrderMapper.insertBaseFileBatch(files);
|
|
|
|
|
}
|
|
|
|
|
equRepairWorkOrderMapper.insertBaseFileBatch(files);
|
|
|
|
|
}
|
|
|
|
|
//维修人:当前登录人
|
|
|
|
|
//维修状态
|
|
|
|
|
equRepairWorkOrder.setWorkStatus("1");
|
|
|
|
|
//维修结束时间
|
|
|
|
|
equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername());
|
|
|
|
|
equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder);
|
|
|
|
|
//需要更新设备状态????这里没做
|
|
|
|
|
return success("提交成功,维修完成!");
|
|
|
|
|
|
|
|
|
|
////更新维修工单
|
|
|
|
|
//维修状态
|
|
|
|
|
equRepairWorkOrder.setWorkStatus("1");
|
|
|
|
|
//维修人
|
|
|
|
|
equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername());
|
|
|
|
|
//维修人员联系方式TODO!!!!
|
|
|
|
|
equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder);
|
|
|
|
|
|
|
|
|
|
//维修工单里面的设备名 简化TODO
|
|
|
|
|
EquRepairWorkOrder example = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
|
|
|
|
|
//修改设备状态 由维修中改为正常运行
|
|
|
|
|
EquEquipment equEquipment = new EquEquipment();
|
|
|
|
|
equEquipment.setEquipmentCode(example.getEquipmentCode());
|
|
|
|
|
equEquipment.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
|
|
|
|
|
return success("提交成功,维修完成!");
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// return error("提交失败!");
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -759,4 +843,38 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
return equEquipmentMapper.selectEquEquipmentList(equEquipment);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新设备运行记录
|
|
|
|
|
* @param equipmentCode
|
|
|
|
|
* @param operationType 开机/停机
|
|
|
|
|
* @param type 保养/维修
|
|
|
|
|
*/
|
|
|
|
|
private void updateOperationRecord(String equipmentCode,String operationType,String type) {
|
|
|
|
|
// 设备最后一条运行记录
|
|
|
|
|
EquOperationRecord lastRecord = equOperationRecordMapper.selectLastOperationRecordByEquipmentCode(equipmentCode);
|
|
|
|
|
if (lastRecord.getMaintenanceType() != null) {
|
|
|
|
|
if (!lastRecord.getMaintenanceType().isEmpty()) {
|
|
|
|
|
if (lastRecord.getMaintenanceType().equals("repair")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
lastRecord.setEndTime(DateUtils.getNowDate());
|
|
|
|
|
lastRecord.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
// 更新运行记录
|
|
|
|
|
equOperationRecordMapper.updateEquOperationRecord(lastRecord);
|
|
|
|
|
// 创建新的运行记录
|
|
|
|
|
EquOperationRecord newRecord = new EquOperationRecord();
|
|
|
|
|
newRecord.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
newRecord.setEquipmentCode(equipmentCode);
|
|
|
|
|
newRecord.setStartTime(DateUtils.getNowDate());
|
|
|
|
|
newRecord.setType(operationType);
|
|
|
|
|
newRecord.setMaintenanceType(type);// 维护类型
|
|
|
|
|
newRecord.setParentId(lastRecord.getId());
|
|
|
|
|
newRecord.setFactoryCode(lastRecord.getFactoryCode());
|
|
|
|
|
newRecord.setCreateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
newRecord.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
equOperationRecordMapper.insertEquOperationRecord(newRecord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|