Merge remote-tracking branch 'origin/master'

master
wws 1 year ago
commit aa95f14f67

@ -154,6 +154,10 @@ public class EquEquipment extends BaseEntity {
@Excel(name = "SAP资产号")
private String sapAsset;
/** 设备状态 */
@Excel(name = "设备状态")
private String equipmentStatus;
public void setEquipmentId(Long equipmentId) {
this.equipmentId = equipmentId;
}
@ -400,6 +404,14 @@ public class EquEquipment extends BaseEntity {
return sapAsset;
}
//设备状态
public void setEquipmentStatus(String equipmentStatus) {
this.equipmentStatus = equipmentStatus;
}
public String getEquipmentStatus() {
return equipmentStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.domain.BaseFileData;
import com.op.device.domain.EquEquipment;
import com.op.device.domain.EquRepairWorkOrder;
import com.op.device.domain.EquTeamUser;
import org.apache.ibatis.annotations.Param;
@ -104,4 +105,11 @@ public interface EquRepairWorkOrderMapper {
* @return
*/
EquRepairWorkOrder selectEquRepairWorkOrderByWorkCode(String workCode);
/**
*
* @param equEquipment
* @return
*/
public int updateEquipmentStatus(EquEquipment equEquipment);
}

@ -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;
@ -555,14 +556,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
*/
@ -635,17 +645,23 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
* @param equRepairWorkOrder
* @return
*/
@Transactional//增加事务注解,出错时自动回滚
@Override
@DS("#header.poolName")
public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) {
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());
@ -654,7 +670,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
for (EquOrderStandard standardList : standardLists) {
//先删除每个检查项标准图片
equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId());
//图片
//图片批量新增
if (StringUtils.isNotEmpty(standardList.getPicturePath())) {
String[] ids = standardList.getPicturePath().split(",");
List<BaseFileData> files = new ArrayList<>();
@ -667,7 +683,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
file.setSourceId(standardList.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
//维修后
//图片类型 维修后
file.setImageType("4");
files.add(file);
}
@ -681,8 +697,11 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
equOrderMapper.updateEquOrder(checkList);
}
}
//新建申领单
////新建申领单
//判空
if(StringUtils.isNotEmpty(equRepairWorkOrder.getApplyList())){
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
for (EquSpareApply equSpareApply : equSpareApplies) {
//生成领料单code
@ -692,30 +711,39 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equSpareApply.setApplyCode("AW" + code + serialNum);
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
//备品备件规格型号!!!!!
// equSpareApply.setSpareModel(equSpareApply.getS);
//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())) {
@ -736,16 +764,29 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
equRepairWorkOrderMapper.insertBaseFileBatch(files);
}
//维修人:当前登录人
////更新维修工单
//维修状态
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("提交失败!");
}
}
/**

@ -164,6 +164,7 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
/**
*
*
*
* @param equRepairOrder
* @return
@ -171,7 +172,7 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
@Override
@DS("#header.poolName")
public int checkEquRepairOrder(EquRepairOrder equRepairOrder) {
//改了,不生成流水号,从第十位开始切割
//不生成流水号,从报修单号第十位开始切割、拼接
String code = equRepairOrder.getOrderCode().substring(10);
String workCode = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + code;
//判断是否是点检、巡检过来的
@ -185,7 +186,6 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
one.setWorkCode("WX" + workCode);
one.setUpdateBy(SecurityUtils.getUsername());
one.setUpdateTime(DateUtils.getNowDate());
//只更新其中一个信息
equOrderMapper.updateEquOrderRepairCode(one);
}
}
@ -196,11 +196,15 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
equRepairWorkOrder.setOrderCode(equRepairOrder.getOrderCode());
//维修单号
equRepairWorkOrder.setWorkCode("WX" + workCode);
//报修id
equRepairWorkOrder.setOrderId(equRepairOrder.getOrderId());
//设备编号
equRepairWorkOrder.setEquipmentCode(equRepairOrder.getEquipmentCode());
//维修组
equRepairWorkOrder.setWorkTeam(equRepairOrder.getWorkTeam());
//不委外
equRepairWorkOrder.setWorkOutsource("0");
//无委外单号
equRepairWorkOrder.setOutWorkCode("无");
//是否立即维修 1是 0 否
equRepairWorkOrder.setWorkHandle("0");
@ -213,7 +217,9 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
}else{
equRepairWorkOrder.setWorkDownMachine("0");
}
//故障描述????
equRepairWorkOrder.setWorkFaultDesc(equRepairOrder.getOrderDesc());
//维修状态 待维修
equRepairWorkOrder.setWorkStatus("0");
equRepairWorkOrder.setWorkId(IdUtils.fastSimpleUUID());
equRepairWorkOrder.setCreateTime(DateUtils.getNowDate());
@ -225,20 +231,35 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder);
equRepairOrder.setOrderStatus("审核通过");
////更新设备状态
EquEquipment equEquipment = new EquEquipment();
equEquipment.setEquipmentCode(equRepairOrder.getEquipmentCode());
//0 故障
equEquipment.setEquipmentStatus("0");
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
}else if(equRepairOrder.getRepairDestination().equals("不维修")){
equRepairOrder.setOrderStatus("驳回");
}else if(equRepairOrder.getRepairDestination().equals("委外维修")){
EquOutsourceWork equOutsourceWork = new EquOutsourceWork();
//委外工单编码、id、联系方式、委外单位、委外人员、委外原因
//id
equOutsourceWork.setWorkId(IdUtils.fastSimpleUUID());
//报修单号
equOutsourceWork.setOrderCode(equRepairOrder.getOrderCode());
//设备编码
equOutsourceWork.setEquipmentCode(equRepairOrder.getEquipmentCode());
//委外工单号
equOutsourceWork.setWorkCode("WW" + workCode);
//维修工单号
equOutsourceWork.setRepairCode("无");
//委外联系方式
equOutsourceWork.setWorkConnection(equRepairOrder.getWorkConnection());
//委外单位
equOutsourceWork.setWorkOutsourcingUnit(equRepairOrder.getWorkOutsourcingUnit());
//委外人员
equOutsourceWork.setWorkPerson(equRepairOrder.getOutSourcePerson());
//委外原因
equOutsourceWork.setWorkReason(equRepairOrder.getOutSourceReason());
//委外类型 维修委外
equOutsourceWork.setWorkType("0");
@ -246,20 +267,35 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
equOutsourceWork.setCreateTime(DateUtils.getNowDate());
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
//工厂号
equOutsourceWork.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equOutsourceWorkMapper.insertEquOutsourceWork(equOutsourceWork);
equRepairOrder.setOrderStatus("审核通过");
////更新设备状态
EquEquipment equEquipment = new EquEquipment();
equEquipment.setEquipmentCode(equRepairOrder.getEquipmentCode());
//0 故障
equEquipment.setEquipmentStatus("0");
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
}else if(equRepairOrder.getRepairDestination().equals("立即维修")){
EquRepairWorkOrder equRepairWorkOrder = new EquRepairWorkOrder();
//维修工单id
equRepairWorkOrder.setWorkId(IdUtils.fastSimpleUUID());
//报修单号
equRepairWorkOrder.setOrderCode(equRepairOrder.getOrderCode());
//维修单号
equRepairWorkOrder.setWorkCode("WX"+workCode);
//orderId
equRepairWorkOrder.setOrderId(equRepairOrder.getOrderId());
//设备编码
equRepairWorkOrder.setEquipmentCode(equRepairOrder.getEquipmentCode());
//维修组
equRepairWorkOrder.setWorkTeam(equRepairOrder.getWorkTeam());
//不委外
equRepairWorkOrder.setWorkOutsource("0");
//无委外工单号
equRepairWorkOrder.setOutWorkCode("无");
//是否立即维修 1是 0 否
equRepairWorkOrder.setWorkHandle("0");
@ -272,9 +308,10 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
}else{
equRepairWorkOrder.setWorkDownMachine("0");
}
//故障描述
equRepairWorkOrder.setWorkFaultDesc(equRepairOrder.getOrderDesc());
//工单状态 待维修
equRepairWorkOrder.setWorkStatus("0");
equRepairWorkOrder.setWorkId(IdUtils.fastSimpleUUID());
equRepairWorkOrder.setCreateTime(DateUtils.getNowDate());
equRepairWorkOrder.setCreateBy(SecurityUtils.getUsername());
//工厂
@ -283,6 +320,14 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService {
equRepairWorkOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder);
equRepairOrder.setOrderStatus("审核通过");
////更新设备状态
EquEquipment equEquipment = new EquEquipment();
equEquipment.setEquipmentCode(equRepairOrder.getEquipmentCode());
//0 故障
equEquipment.setEquipmentStatus("0");
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
}
equRepairOrder.setUpdateTime(DateUtils.getNowDate());
equRepairOrder.setUpdateBy(SecurityUtils.getUsername());

@ -185,6 +185,15 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService
equOrderStandard.setUpdateTime(DateUtils.getNowDate());
equOrderStandardMapper.updateStandardAfterRepair(equOrderStandard);
}
if(equRepairWorkOrder.getWorkStatus().equals("1")){
//修改设备状态 由维修中改为正常运行
EquEquipment equEquipment = new EquEquipment();
equEquipment.setEquipmentCode(equRepairWorkOrder.getEquipmentCode());
equEquipment.setEquipmentStatus("1");
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
}
return equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder);
}

@ -477,4 +477,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and del_flag = '0'
</update>
<update id="updateEquipmentStatus" parameterType="com.op.device.domain.EquEquipment">
update base_equipment
set equipment_status = #{equipmentStatus}
where equipment_code = #{equipmentCode}
and del_flag = '0'
</update>
</mapper>
Loading…
Cancel
Save