设备-工单逻辑变更

highway
wws 1 year ago
parent 76bdb1fbb3
commit 560d3dff2f

@ -152,6 +152,26 @@ public class EquOrder extends BaseEntity {
private String equipmentName; private String equipmentName;
private String planRestrict; private String planRestrict;
private List<EquOrderDetail> detailList;
private List<EquOrderEquSpare> spareList;
public List<EquOrderEquSpare> getSpareList() {
return spareList;
}
public void setSpareList(List<EquOrderEquSpare> spareList) {
this.spareList = spareList;
}
public List<EquOrderDetail> getDetailList() {
return detailList;
}
public void setDetailList(List<EquOrderDetail> detailList) {
this.detailList = detailList;
}
public String getPlanRestrict() { public String getPlanRestrict() {
return planRestrict; return planRestrict;
} }

@ -120,4 +120,10 @@ public interface EquOrderMapper {
*/ */
List<EquOrder> selectTodayTask(PDADTO pdadto); List<EquOrder> selectTodayTask(PDADTO pdadto);
/**
*
* @param equipmentCode
* @return
*/
String selectEquipmentNameByEquCode(String equipmentCode);
} }

@ -70,23 +70,28 @@ public class EquOrderServiceImpl implements IEquOrderService {
timeArray.add(order.getOrderStart()); timeArray.add(order.getOrderStart());
timeArray.add(order.getOrderEnd()); timeArray.add(order.getOrderEnd());
order.setTimeArray(timeArray); order.setTimeArray(timeArray);
// 设置设备名称
order.setEquipmentName(equOrderMapper.selectEquipmentNameByEquCode(order.getEquipmentCode()));
// 设置计划名称
order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode())); order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode()));
// 工作中心(车间)
order.setWorkCenterName(equOrderMapper.selectCenterNameByCenterCode(order.getPlanWorkshop())); order.setWorkCenterName(equOrderMapper.selectCenterNameByCenterCode(order.getPlanWorkshop()));
EquOrderEqu equ = equOrderEquMapper.selectEquOrderEquListByOrderCode(order.getOrderCode()); // 检查项
List<EquOrderDetail> detailList = equOrderDetailMapper.selectEquOrderDetailByOrderCode(order.getOrderCode());
List<EquOrderDetail> detailList = equOrderDetailMapper.selectEquOrderDetailByParentCode(equ.getId());
for (EquOrderDetail detail : detailList) { for (EquOrderDetail detail : detailList) {
// 标准
List<EquOrderStandard> standardList = equOrderStandardMapper.selectEquOrderStandardByParentCode(detail.getId()); List<EquOrderStandard> standardList = equOrderStandardMapper.selectEquOrderStandardByParentCode(detail.getId());
detail.setStandardList(standardList); detail.setStandardList(standardList);
} }
equ.setDetailList(detailList); order.setDetailList(detailList);
List<EquOrderEquSpare> spareList = equOrderEquSpareMapper.selectEquOrderEquSpareByParentCode(equ.getId()); // 备件
List<EquOrderEquSpare> spareList = equOrderEquSpareMapper.selectEquOrderEquSpareByOrderCode(order.getOrderCode());
if (spareList.size() > 0) { if (spareList.size() > 0) {
equ.setSpareList(spareList); order.setSpareList(spareList);
} }
// 人员信息 // 人员信息
@ -100,8 +105,6 @@ public class EquOrderServiceImpl implements IEquOrderService {
order.setPersonList(personList); order.setPersonList(personList);
order.setEqu(equ);
return order; return order;
} }
@ -116,9 +119,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
public List<EquOrder> selectEquOrderList(EquOrder equOrder) { public List<EquOrder> selectEquOrderList(EquOrder equOrder) {
List<EquOrder> orderList = equOrderMapper.selectEquOrderList(equOrder); List<EquOrder> orderList = equOrderMapper.selectEquOrderList(equOrder);
for (EquOrder order : orderList) { for (EquOrder order : orderList) {
EquOrderEqu equ = equOrderEquMapper.selectEquOrderEquListByOrderCode(order.getOrderCode()); order.setEquipmentName(equOrderMapper.selectEquipmentNameByEquCode(order.getEquipmentCode()));
order.setEquipmentCode(equ.getEquipmentCode());
order.setEquipmentName(equ.getEquipmentName());
} }
return orderList; return orderList;
} }

@ -102,22 +102,12 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
equOrder.setUpdateBy(SecurityContextHolder.getUserName()); equOrder.setUpdateBy(SecurityContextHolder.getUserName());
equOrder.setUpdateTime(DateUtils.getNowDate()); equOrder.setUpdateTime(DateUtils.getNowDate());
equOrder.setPlanType("maintenance"); equOrder.setPlanType("maintenance");
equOrder.setEquipmentCode(equPlan.getEquipmentItem().get(0).getEquipmentCode());
// 工单插入数据库 // 工单插入数据库
equOrderMapper.insertEquOrder(equOrder); equOrderMapper.insertEquOrder(equOrder);
// 生成工单-设备 EquPlanEqu equPlanEqu = equPlan.getEquipmentItem().get(0);
EquOrderEqu equ = new EquOrderEqu();
List<EquPlanEqu> equPlanEquList = equPlan.getEquipmentItem();
EquPlanEqu equPlanEqu = equPlanEquList.get(0);
BeanUtils.copyProperties(equPlanEqu,equ);
equ.setId(IdUtils.fastSimpleUUID());
equ.setParentCode(equOrder.getOrderId());
equ.setOrderCode(equOrder.getOrderCode());
equ.setFactoryCode(factory);
equ.setAttr1("");
equ.setCreateBy(SecurityContextHolder.getUserName());
// 设备插入
equOrderEquMapper.insertEquOrderEqu(equ);
// 生成工单-备件 // 生成工单-备件
List<EquOrderEquSpare> spareList = new ArrayList<>(); List<EquOrderEquSpare> spareList = new ArrayList<>();
List<EquPlanEquSpare> equSpareList = equPlanEqu.getSpareList(); List<EquPlanEquSpare> equSpareList = equPlanEqu.getSpareList();
@ -127,7 +117,6 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
BeanUtils.copyProperties(spare,spareTemp); BeanUtils.copyProperties(spare,spareTemp);
spareTemp.setId(IdUtils.fastSimpleUUID()); spareTemp.setId(IdUtils.fastSimpleUUID());
spareTemp.setOrderCode(equOrder.getOrderCode()); spareTemp.setOrderCode(equOrder.getOrderCode());
spareTemp.setParentCode(equ.getId());
spareTemp.setFactoryCode(factory); spareTemp.setFactoryCode(factory);
spareTemp.setCreateBy(SecurityContextHolder.getUserName()); spareTemp.setCreateBy(SecurityContextHolder.getUserName());
spareTemp.setCreateTime(DateUtils.getNowDate()); spareTemp.setCreateTime(DateUtils.getNowDate());
@ -149,7 +138,6 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
BeanUtils.copyProperties(detail,equOrderDetail); BeanUtils.copyProperties(detail,equOrderDetail);
equOrderDetail.setId(IdUtils.fastSimpleUUID()); equOrderDetail.setId(IdUtils.fastSimpleUUID());
equOrderDetail.setOrderCode(equOrder.getOrderCode()); equOrderDetail.setOrderCode(equOrder.getOrderCode());
equOrderDetail.setParentCode(equ.getId());
equOrderDetail.setFactoryCode(factory); equOrderDetail.setFactoryCode(factory);
equOrderDetail.setStandardList(orderStandardList); equOrderDetail.setStandardList(orderStandardList);
equOrderDetail.setCreateBy(SecurityContextHolder.getUserName()); equOrderDetail.setCreateBy(SecurityContextHolder.getUserName());

@ -62,12 +62,10 @@ public class InspectionWorkServiceImpl implements IInspectionWorkService {
// 替换循环周期 // 替换循环周期
order.setPlanLoopType(equOrderMapper.changeLoopType(order.getPlanLoopType())); order.setPlanLoopType(equOrderMapper.changeLoopType(order.getPlanLoopType()));
EquOrderEqu equ = equOrderEquMapper.selectEquOrderEquListByOrderCode(order.getOrderCode()); Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(order.getEquipmentCode());
Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(equ.getEquipmentCode());
// 查询检查项、标准 // 查询检查项、标准
List<EquOrderDetail> detailList = equOrderDetailMapper.selectEquOrderDetailByParentCode(equ.getId()); List<EquOrderDetail> detailList = equOrderDetailMapper.selectEquOrderDetailByOrderCode(order.getOrderCode());
for (EquOrderDetail detail : detailList) { for (EquOrderDetail detail : detailList) {
List<EquOrderStandard> standardList = equOrderStandardMapper.selectEquOrderStandardByParentCode(detail.getId()); List<EquOrderStandard> standardList = equOrderStandardMapper.selectEquOrderStandardByParentCode(detail.getId());
for (EquOrderStandard standard : standardList) { for (EquOrderStandard standard : standardList) {

@ -139,6 +139,10 @@
) )
</select> </select>
<select id="selectEquipmentNameByEquCode" resultType="java.lang.String">
select equipment_name AS 'equipmentName' from base_equipment where equipment_code = #{equipmentCode} and del_flag = '0'
</select>
<insert id="insertEquOrder" parameterType="EquOrder"> <insert id="insertEquOrder" parameterType="EquOrder">
insert into equ_order insert into equ_order
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -178,7 +182,6 @@
<if test="repairCode != null">repair_code,</if> <if test="repairCode != null">repair_code,</if>
<if test="workCode != null">work_code,</if> <if test="workCode != null">work_code,</if>
<if test="planRestrict != null">plan_restrict,</if> <if test="planRestrict != null">plan_restrict,</if>
<if test="shutDown != null">shut_down,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
@ -216,7 +219,6 @@
<if test="repairCode != null">#{repairCode},</if> <if test="repairCode != null">#{repairCode},</if>
<if test="workCode != null">#{workCode},</if> <if test="workCode != null">#{workCode},</if>
<if test="planRestrict != null">#{planRestrict},</if> <if test="planRestrict != null">#{planRestrict},</if>
<if test="shutDown != null">#{shutDown},</if>
</trim> </trim>
</insert> </insert>

Loading…
Cancel
Save