|
|
@ -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());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sce = equOrderEquSpareMapper.insertEquOrderEquSpares(spares);
|
|
|
|
if(!CollectionUtils.isEmpty(spares)){
|
|
|
|
System.out.println(plan.getPlanCode()+"========equ_order_equ_spare:"+sce);
|
|
|
|
sce = equOrderEquSpareMapper.insertEquOrderEquSpares(spares);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
System.out.println(plan.getPlanCode() + "========equ_order_detail:" + sce);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sce = equOrderDetailMapper.insertEquOrderDetails(details);
|
|
|
|
|
|
|
|
System.out.println(plan.getPlanCode()+"========equ_order_detail:"+sce);
|
|
|
|
|
|
|
|
/**equ_plan_standard->equ_order_standard*******************************************************/
|
|
|
|
/**equ_plan_standard->equ_order_standard*******************************************************/
|
|
|
|
if(CollectionUtils.isEmpty(standards)){
|
|
|
|
if(!CollectionUtils.isEmpty(standards)) {
|
|
|
|
return 0;
|
|
|
|
sce = equOrderStandardMapper.insertEquOrderStandards(standards);
|
|
|
|
|
|
|
|
System.out.println(plan.getPlanCode() + "========equ_order_detail:" + sce);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sce = equOrderStandardMapper.insertEquOrderStandards(standards);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sce = equOrderPersonMapper.insertEquOrderPlans(persons);
|
|
|
|
if(!CollectionUtils.isEmpty(persons)) {
|
|
|
|
System.out.println(plan.getPlanCode()+"========equ_order_standard:"+sce);
|
|
|
|
sce = equOrderPersonMapper.insertEquOrderPlans(persons);
|
|
|
|
|
|
|
|
System.out.println(plan.getPlanCode() + "========equ_order_standard:" + sce);
|
|
|
|
|
|
|
|
}
|
|
|
|
return sce;
|
|
|
|
return sce;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|