|
|
|
@ -33,8 +33,6 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquOrderMapper equOrderMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquOrderEquSpareMapper equOrderEquSpareMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquOrderStandardMapper equOrderStandardMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquOrderDetailMapper equOrderDetailMapper;
|
|
|
|
@ -42,6 +40,10 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
|
|
|
|
|
private EquOrderPersonMapper equOrderPersonMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquOrderEquMapper equOrderEquMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquSpareApplyMapper equSpareApplyMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SparePartsLedgerMapper sparePartsLedgerMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询保养工单
|
|
|
|
@ -68,7 +70,7 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TODO 快速工单
|
|
|
|
|
* 快速工单
|
|
|
|
|
*
|
|
|
|
|
* @param equPlan 保养工单
|
|
|
|
|
* @return 结果
|
|
|
|
@ -92,8 +94,10 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
|
|
|
|
|
String serialNum = String.format("%03d",equOrderMapper.selectSerialNumber());
|
|
|
|
|
equOrder.setOrderCode("F"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+serialNum);
|
|
|
|
|
equOrder.setPlanLoopType("");
|
|
|
|
|
equOrder.setPlanLoopStart(equPlan.getPlanTimeArray().get(0));
|
|
|
|
|
equOrder.setPlanLoopEnd(equPlan.getPlanTimeArray().get(1));
|
|
|
|
|
if (equPlan.getPlanTimeArray() != null) {
|
|
|
|
|
equOrder.setPlanLoopStart(equPlan.getPlanTimeArray().get(0));
|
|
|
|
|
equOrder.setPlanLoopEnd(equPlan.getPlanTimeArray().get(1));
|
|
|
|
|
}
|
|
|
|
|
// 设置工单状态
|
|
|
|
|
equOrder.setOrderStatus("0");
|
|
|
|
|
equOrder.setFactoryCode(factory);
|
|
|
|
@ -109,22 +113,32 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
|
|
|
|
|
EquPlanEqu equPlanEqu = equPlan.getEquipmentItem().get(0);
|
|
|
|
|
|
|
|
|
|
// 生成工单-备件
|
|
|
|
|
List<EquOrderEquSpare> spareList = new ArrayList<>();
|
|
|
|
|
List<EquPlanEquSpare> equSpareList = equPlanEqu.getSpareList();
|
|
|
|
|
if (equSpareList != null) {
|
|
|
|
|
// 获取流水单号
|
|
|
|
|
int applySerialNum = equSpareApplyMapper.selectSerialNumber();
|
|
|
|
|
|
|
|
|
|
for (EquPlanEquSpare spare : equSpareList) {
|
|
|
|
|
EquOrderEquSpare spareTemp = new EquOrderEquSpare();
|
|
|
|
|
BeanUtils.copyProperties(spare,spareTemp);
|
|
|
|
|
spareTemp.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
spareTemp.setOrderCode(equOrder.getOrderCode());
|
|
|
|
|
spareTemp.setFactoryCode(factory);
|
|
|
|
|
spareTemp.setCreateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
spareTemp.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
spareTemp.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
spareTemp.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
EquSpareApply apply = new EquSpareApply();
|
|
|
|
|
apply.setApplyId(IdUtils.fastSimpleUUID());
|
|
|
|
|
apply.setApplyCode("A"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+String.format("%03d",applySerialNum));
|
|
|
|
|
applySerialNum++;
|
|
|
|
|
apply.setSpareCode(spare.getMaterialCode());
|
|
|
|
|
apply.setSpareName(spare.getMaterialDesc());
|
|
|
|
|
apply.setSpareModel(spare.getSpareType());
|
|
|
|
|
apply.setSpareQuantity(spare.getApplyNum());
|
|
|
|
|
apply.setFactoryCode(factory);
|
|
|
|
|
apply.setApplyPeople(SecurityContextHolder.getUserName());
|
|
|
|
|
apply.setParentCode(equOrder.getOrderCode());
|
|
|
|
|
apply.setCreateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
apply.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
apply.setSpareUseEquipment(equOrder.getEquipmentCode());
|
|
|
|
|
apply.setApplyTime(DateUtils.getNowDate());
|
|
|
|
|
// 插入备件信息
|
|
|
|
|
equOrderEquSpareMapper.insertEquOrderEquSpare(spareTemp);
|
|
|
|
|
spareList.add(spareTemp);
|
|
|
|
|
equSpareApplyMapper.insertEquSpareApply(apply);
|
|
|
|
|
|
|
|
|
|
// TODO 减少备件仓库中备件数量
|
|
|
|
|
sparePartsLedgerMapper.updateSpareNumReduce(apply);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|