维修/保养-备件单价逻辑

master
wws 1 year ago
parent 4e65a7d092
commit 3bd7eeb1ed

@ -1,5 +1,6 @@
package com.op.device.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.op.device.domain.EquRepairWorkOrder;
@ -93,4 +94,11 @@ public interface EquSpareApplyMapper {
* @param id
*/
void delEquSpareApplyByApplyId(String id);
/**
*
* @param orderCode
* @return
*/
BigDecimal getSparePartsCost(String orderCode);
}

@ -30,10 +30,6 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
@Autowired
private DeviceInterfaceMapper deviceInterfaceMapper;
@Autowired
private EquOperationRecordMapper equOperationRecordMapper;
@Autowired
private EquOperationMapper equOperationMapper;
/**
*
@ -102,17 +98,6 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
}
}
// 排序TOP10
// 假数据
// Random random = new Random();
// List<IEquipmentVO> test = new ArrayList<>();
// for (int i = 0 ; i < 30 ; i++) {
// IEquipmentVO vo = new IEquipmentVO();
// vo.setRapairQuantity(random.nextDouble());
// test.add(vo);
// }
// 按照raparQuantity字段进行排序并使用subList获取前10个结果
List<IEquipmentVO> top10 = equipmentVOList.stream()
.sorted(Comparator.comparingDouble(IEquipmentVO::getRapairQuantity)) // 排序

@ -362,6 +362,12 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
// 创建设备对象用于更新设备状态
Equipment equ = new Equipment();
equ.setEquipmentCode(equOrder.getEquipmentCode());
// 费用
BigDecimal sparePartsCost = equSpareApplyMapper.getSparePartsCost(equOrder.getOrderCode());
BigDecimal orderCost = equOrder.getOrderCost();
equOrder.setOrderCost(sparePartsCost.add(orderCost));
// 更新设备状态为正常运行
equ.setStatus("1");
equOrderMapper.updateEquipmentStatus(equ);
@ -824,6 +830,12 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
//维修工单里面的设备名 简化TODO
EquRepairWorkOrder example = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
// 费用
BigDecimal sparePartsCost = equSpareApplyMapper.getSparePartsCost(equRepairWorkOrder.getOrderCode());
BigDecimal orderCost = BigDecimal.valueOf(Double.valueOf(equRepairWorkOrder.getWorkCost()));
equRepairWorkOrder.setWorkCost(String.valueOf(sparePartsCost.add(orderCost)));
//修改设备状态 由维修中改为正常运行
EquEquipment equEquipment = new EquEquipment();
equEquipment.setEquipmentCode(example.getEquipmentCode());

@ -1,5 +1,6 @@
package com.op.device.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -348,6 +349,11 @@ public class EquOrderServiceImpl implements IEquOrderService {
long diffSeconds = (equOrder.getOrderEnd().getTime() - equOrder.getOrderStart().getTime()) / 60000;
equOrder.setOrderCostTime(String.valueOf(diffSeconds));
}
// 费用
BigDecimal sparePartsCost = equSpareApplyMapper.getSparePartsCost(equOrder.getOrderCode());
BigDecimal orderCost = equOrder.getOrderCost();
equOrder.setOrderCost(sparePartsCost.add(orderCost));
// 保养图片
if (StringUtils.isNotEmpty(equOrder.getPicturePath())) {
String[] ids = equOrder.getPicturePath().split(",");

@ -1,5 +1,6 @@
package com.op.device.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@ -43,6 +44,9 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService
@Autowired
private EquOutsourceWorkMapper equOutsourceWorkMapper;
@Autowired
private EquSpareApplyMapper equSpareApplyMapper;
/**
*
*
@ -218,6 +222,11 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
}
// 费用
BigDecimal sparePartsCost = equSpareApplyMapper.getSparePartsCost(equRepairWorkOrder.getOrderCode());
BigDecimal orderCost = BigDecimal.valueOf(Double.valueOf(equRepairWorkOrder.getWorkCost()));
equRepairWorkOrder.setWorkCost(String.valueOf(sparePartsCost.add(orderCost)));
return equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder);
}

@ -207,4 +207,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where work_code = #{orderCode} and del_flag = '0'
</select>
<select id="getSparePartsCost" resultType="java.math.BigDecimal">
select SUM(a.spare_quantity * w.unit_price)
from equ_spare_apply a
left join wms_ods_mate_storage_news_attached w on a.spare_code = w.primary_code
where a.work_code = #{orderCode}
</select>
</mapper>
Loading…
Cancel
Save