设备-工单逻辑变更

highway
wws 1 year ago
parent 76bdb1fbb3
commit 560d3dff2f

@ -152,6 +152,26 @@ public class EquOrder extends BaseEntity {
private String equipmentName;
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() {
return planRestrict;
}

@ -120,4 +120,10 @@ public interface EquOrderMapper {
*/
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.getOrderEnd());
order.setTimeArray(timeArray);
// 设置设备名称
order.setEquipmentName(equOrderMapper.selectEquipmentNameByEquCode(order.getEquipmentCode()));
// 设置计划名称
order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode()));
// 工作中心(车间)
order.setWorkCenterName(equOrderMapper.selectCenterNameByCenterCode(order.getPlanWorkshop()));
EquOrderEqu equ = equOrderEquMapper.selectEquOrderEquListByOrderCode(order.getOrderCode());
List<EquOrderDetail> detailList = equOrderDetailMapper.selectEquOrderDetailByParentCode(equ.getId());
// 检查项
List<EquOrderDetail> detailList = equOrderDetailMapper.selectEquOrderDetailByOrderCode(order.getOrderCode());
for (EquOrderDetail detail : detailList) {
// 标准
List<EquOrderStandard> standardList = equOrderStandardMapper.selectEquOrderStandardByParentCode(detail.getId());
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) {
equ.setSpareList(spareList);
order.setSpareList(spareList);
}
// 人员信息
@ -100,8 +105,6 @@ public class EquOrderServiceImpl implements IEquOrderService {
order.setPersonList(personList);
order.setEqu(equ);
return order;
}
@ -116,9 +119,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
public List<EquOrder> selectEquOrderList(EquOrder equOrder) {
List<EquOrder> orderList = equOrderMapper.selectEquOrderList(equOrder);
for (EquOrder order : orderList) {
EquOrderEqu equ = equOrderEquMapper.selectEquOrderEquListByOrderCode(order.getOrderCode());
order.setEquipmentCode(equ.getEquipmentCode());
order.setEquipmentName(equ.getEquipmentName());
order.setEquipmentName(equOrderMapper.selectEquipmentNameByEquCode(order.getEquipmentCode()));
}
return orderList;
}

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

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

@ -139,6 +139,10 @@
)
</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 into equ_order
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -178,7 +182,6 @@
<if test="repairCode != null">repair_code,</if>
<if test="workCode != null">work_code,</if>
<if test="planRestrict != null">plan_restrict,</if>
<if test="shutDown != null">shut_down,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
@ -216,7 +219,6 @@
<if test="repairCode != null">#{repairCode},</if>
<if test="workCode != null">#{workCode},</if>
<if test="planRestrict != null">#{planRestrict},</if>
<if test="shutDown != null">#{shutDown},</if>
</trim>
</insert>

Loading…
Cancel
Save