Merge remote-tracking branch 'origin/master'

highway
wws 1 year ago
commit d53c96be6b

@ -54,11 +54,6 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
@Autowired @Autowired
private EquPlanDetailMapper equPlanDetailMapper; private EquPlanDetailMapper equPlanDetailMapper;
@Autowired
private EquPlanEquMapper equPlanEquMapper;
@Autowired
private EquOrderEquMapper equOrderEquMapper;
@Autowired @Autowired
private EquPlanEquSpareMapper equPlanEquSpareMapper; private EquPlanEquSpareMapper equPlanEquSpareMapper;
@Autowired @Autowired
@ -229,6 +224,8 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
}else if("0".equals(plan.getCalculationRule())){ }else if("0".equals(plan.getCalculationRule())){
//根据createTime//0按固定周期 //根据createTime//0按固定周期
hasTask = deviceTaskMapper.getNewTaskOrder(plan); hasTask = deviceTaskMapper.getNewTaskOrder(plan);
}else if("2".equals(plan.getCalculationRule())){
//单次生成保养计划
} }
if(hasTask==null || Integer.parseInt(plan.getPlanLoop())<= hasTask.getDays()){ if(hasTask==null || Integer.parseInt(plan.getPlanLoop())<= hasTask.getDays()){
@ -260,50 +257,27 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
/**equ_order**/ /**equ_order**/
sce = equOrderMapper.insertEquOrder(order); sce = equOrderMapper.insertEquOrder(order);
System.out.println(plan.getPlanCode()+"========equ_order:"+sce); System.out.println(plan.getPlanCode()+"========equ_order:"+sce);
/**equ_plan_equ->equ_order_equ*************************************************************/
EquPlanEqu equPlanEqu = new EquPlanEqu();
equPlanEqu.setId(plan.getPlanEquId());
List<EquPlanEqu> equs = equPlanEquMapper.selectEquPlanEquList(equPlanEqu);
if(CollectionUtils.isEmpty(equs)){
return 0;
}
String orderEquId = IdUtils.fastSimpleUUID();
//equs一定就一个实值
for(EquPlanEqu equ:equs){
equ.setId(orderEquId);
equ.setCreateTime(nowtime);
equ.setCreateBy(createBy);
equ.setDelFlag("0");
equ.setCode(orderCode);
}
sce = equOrderEquMapper.insertEquOrderEqus(equs);
System.out.println(plan.getPlanCode()+"========equ_order_equ:"+sce);
/**equ_plan_equ_spare->equ_order_equ_spare*************************************************************/ /**equ_plan_equ_spare->equ_order_equ_spare*************************************************************/
EquPlanEquSpare equPlanEquSpare = new EquPlanEquSpare(); EquPlanEquSpare equPlanEquSpare = new EquPlanEquSpare();
equPlanEquSpare.setParentCode(plan.getPlanEquId()); equPlanEquSpare.setParentCode(plan.getPlanEquId());
List<EquPlanEquSpare> spares = equPlanEquSpareMapper.selectEquPlanEquSpareList(equPlanEquSpare); List<EquPlanEquSpare> spares = equPlanEquSpareMapper.selectEquPlanEquSpareList(equPlanEquSpare);
if(CollectionUtils.isEmpty(spares)){
return 0;
}
for(EquPlanEquSpare spare:spares){ for(EquPlanEquSpare spare:spares){
spare.setId(IdUtils.fastSimpleUUID()); spare.setId(IdUtils.fastSimpleUUID());
spare.setCreateTime(nowtime); spare.setCreateTime(nowtime);
spare.setCreateBy(createBy); spare.setCreateBy(createBy);
spare.setDelFlag("0"); spare.setDelFlag("0");
spare.setCode(orderCode); spare.setCode(orderCode);
spare.setParentCode(plan.getPlanEquId());
} }
if(!CollectionUtils.isEmpty(spares)){
sce = equOrderEquSpareMapper.insertEquOrderEquSpares(spares); sce = equOrderEquSpareMapper.insertEquOrderEquSpares(spares);
System.out.println(plan.getPlanCode()+"========equ_order_equ_spare:"+sce); System.out.println(plan.getPlanCode()+"========equ_order_equ_spare:"+sce);
}
/**equ_plan_detail->equ_order_detail*******************************************************/ /**equ_plan_detail->equ_order_detail*******************************************************/
EquPlanDetail itqo = new EquPlanDetail(); EquPlanDetail itqo = new EquPlanDetail();
itqo.setParentCode(plan.getPlanEquId()); itqo.setParentCode(plan.getPlanEquId());
itqo.setDelFlag("0"); itqo.setDelFlag("0");
List<EquPlanDetail> details = equPlanDetailMapper.selectEquPlanDetailList(itqo); List<EquPlanDetail> details = equPlanDetailMapper.selectEquPlanDetailList(itqo);
if(CollectionUtils.isEmpty(details)){
return 0;
}
List<EquPlanStandard> standards = new ArrayList<>(); List<EquPlanStandard> standards = new ArrayList<>();
List<EquPlanStandard> standards0 = null; List<EquPlanStandard> standards0 = null;
@ -327,23 +301,21 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
itme.setCreateTime(nowtime); itme.setCreateTime(nowtime);
itme.setCreateBy(createBy); itme.setCreateBy(createBy);
itme.setDelFlag("0"); itme.setDelFlag("0");
itme.setParentCode(orderEquId); itme.setParentCode(orderCode);
} }
if(!CollectionUtils.isEmpty(details)) {
sce = equOrderDetailMapper.insertEquOrderDetails(details); sce = equOrderDetailMapper.insertEquOrderDetails(details);
System.out.println(plan.getPlanCode()+"========equ_order_detail:"+sce); System.out.println(plan.getPlanCode() + "========equ_order_detail:" + sce);
/**equ_plan_standard->equ_order_standard*******************************************************/
if(CollectionUtils.isEmpty(standards)){
return 0;
} }
/**equ_plan_standard->equ_order_standard*******************************************************/
if(!CollectionUtils.isEmpty(standards)) {
sce = equOrderStandardMapper.insertEquOrderStandards(standards); sce = equOrderStandardMapper.insertEquOrderStandards(standards);
System.out.println(plan.getPlanCode()+"========equ_order_detail:"+sce); System.out.println(plan.getPlanCode() + "========equ_order_detail:" + sce);
}
/**equ_plan_person->equ_order_standard*********************************************************/ /**equ_plan_person->equ_order_standard*********************************************************/
EquPlanPerson equPlanPerson = new EquPlanPerson(); EquPlanPerson equPlanPerson = new EquPlanPerson();
equPlanPerson.setPlanCode(plan.getPlanCode()); equPlanPerson.setPlanCode(plan.getPlanCode());
List<EquPlanPerson> persons = equPlanPersonMapper.selectEquPlanPersonList(equPlanPerson); List<EquPlanPerson> persons = equPlanPersonMapper.selectEquPlanPersonList(equPlanPerson);
if(CollectionUtils.isEmpty(persons)){
return 0;
}
for(EquPlanPerson person:persons){ for(EquPlanPerson person:persons){
person.setId(IdUtils.fastSimpleUUID()); person.setId(IdUtils.fastSimpleUUID());
@ -352,8 +324,10 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
person.setDelFlag("0"); person.setDelFlag("0");
person.setPlanCode(orderCode); person.setPlanCode(orderCode);
} }
if(!CollectionUtils.isEmpty(persons)) {
sce = equOrderPersonMapper.insertEquOrderPlans(persons); sce = equOrderPersonMapper.insertEquOrderPlans(persons);
System.out.println(plan.getPlanCode()+"========equ_order_standard:"+sce); System.out.println(plan.getPlanCode() + "========equ_order_standard:" + sce);
}
return sce; return sce;
} }
} }

@ -17,6 +17,7 @@
ep.plan_outsource planOutsource, ep.plan_outsource planOutsource,
ep.calculation_rule calculationRule, ep.calculation_rule calculationRule,
ep.shut_down as 'shutDown', ep.shut_down as 'shutDown',
ep.upkeep,
epe.equipment_code equipmentCode, epe.equipment_code equipmentCode,
epe.equipment_name equipmentName, epe.equipment_name equipmentName,
epe.id planEquId epe.id planEquId
@ -25,7 +26,7 @@
where ep.del_flag = '0' and epe.del_flag = '0' and ep.plan_status = '0' where ep.del_flag = '0' and epe.del_flag = '0' and ep.plan_status = '0'
and ep.plan_type = #{planType} and ep.plan_type = #{planType}
and CONVERT(varchar(10),GETDATE(), 120) >= CONVERT(varchar(10),ep.plan_loop_start, 120) and CONVERT(varchar(10),GETDATE(), 120) >= CONVERT(varchar(10),ep.plan_loop_start, 120)
<if test='planType=="inspection" or (planType=="maintenance" and calculationRule=="0")'> <if test='planType=="inspection" or planType=="maintenance" '>
and CONVERT(varchar(10),ep.plan_loop_end, 120) >= CONVERT(varchar(10),GETDATE(), 120) and CONVERT(varchar(10),ep.plan_loop_end, 120) >= CONVERT(varchar(10),GETDATE(), 120)
</if> </if>
</select> </select>
@ -38,7 +39,7 @@
<if test='planLoopType=="season"'> DATEDIFF (month, create_time, GETDATE())/3 days </if> <if test='planLoopType=="season"'> DATEDIFF (month, create_time, GETDATE())/3 days </if>
<if test='planLoopType=="year"'> DATEDIFF (year, create_time, GETDATE()) days </if> <if test='planLoopType=="year"'> DATEDIFF (year, create_time, GETDATE()) days </if>
from equ_order from equ_order
where plan_type = #{planType} and plan_code = #{planCode} where plan_type = #{planType} and plan_code = #{planCode} and equipment_code = #{equipmentCode}
order by create_time desc order by create_time desc
</select> </select>
<select id="getNewTaskOrder0" resultType="com.op.device.domain.EquOrder"> <select id="getNewTaskOrder0" resultType="com.op.device.domain.EquOrder">
@ -50,7 +51,7 @@
<if test='planLoopType=="season"'> DATEDIFF (month, order_start, GETDATE())/3 days </if> <if test='planLoopType=="season"'> DATEDIFF (month, order_start, GETDATE())/3 days </if>
<if test='planLoopType=="year"'> DATEDIFF (year, order_start, GETDATE()) days </if> <if test='planLoopType=="year"'> DATEDIFF (year, order_start, GETDATE()) days </if>
from equ_order from equ_order
where plan_type = #{planType} and plan_code = #{planCode} where plan_type = #{planType} and plan_code = #{planCode} and equipment_code = #{equipmentCode}
order by create_time desc order by create_time desc
</select> </select>
</mapper> </mapper>

@ -112,7 +112,7 @@
<insert id="insertEquOrderDetails"> <insert id="insertEquOrderDetails">
insert into equ_order_detail insert into equ_order_detail
( (
id, parent_code, id, order_code,
item_code, item_name, item_method, item_code, item_name, item_method,
item_type, item_type_name, factory_code, del_flag, item_type, item_type_name, factory_code, del_flag,
create_by, create_time create_by, create_time

@ -107,23 +107,19 @@
</insert> </insert>
<insert id="insertEquOrderEquSpares"> <insert id="insertEquOrderEquSpares">
insert into equ_order_equ_spare( insert into equ_order_equ_spare(
id, order_code, parent_code, material_code, material_desc, id, order_code, material_code, material_desc,
spare_type, apply_num, factory_code, del_flag, spare_type, apply_num, factory_code, del_flag,
create_by, create_time, create_by, create_time
)values )
VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
( (
#{item.id},#{item.code},#{item.parentCode},#{item.materialCode},#{item.materialDesc}, #{item.id},#{item.code},#{item.materialCode},#{item.materialDesc},
#{item.spareType},#{item.applyNum},#{item.factoryCode},#{item.delFlag}, #{item.spareType},#{item.applyNum},#{item.factoryCode},#{item.delFlag},
#{item.createBy},#{item.createTime} #{item.createBy},#{item.createTime}
) )
</foreach> </foreach>
select id, code, order_code, parent_code, material_code, material_desc,
spare_type, apply_num, factory_code, attr1, attr2, attr3, del_flag,
create_by, create_time, update_by, update_time
from
</insert> </insert>
<update id="updateEquOrderEquSpare" parameterType="EquOrderEquSpare"> <update id="updateEquOrderEquSpare" parameterType="EquOrderEquSpare">

Loading…
Cancel
Save