소스 검색

pms 瑞鹰修井新疆项目 生产动态明细 添加 定额时效

zhangcl 22 시간 전
부모
커밋
f3a57c8edc

+ 8 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreportdetail/vo/IotRyDailyReportDetailRespVO.java

@@ -70,6 +70,14 @@ public class IotRyDailyReportDetailRespVO {
     @ExcelProperty("工况")
     private String currentOperation;
 
+    @Schema(description = "定额时长(H)")
+    @ExcelProperty("定额时长(H)")
+    private BigDecimal allocatedTime;
+
+    @Schema(description = "定额时效(%)")
+    @ExcelProperty("定额时效(%)")
+    private BigDecimal allocatedEfficiency;
+
     @Schema(description = "排序值")
     @ExcelProperty("排序值")
     private Integer sort;

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreportdetail/vo/IotRyDailyReportDetailSaveReqVO.java

@@ -49,6 +49,12 @@ public class IotRyDailyReportDetailSaveReqVO {
     @Schema(description = "当日施工详情")
     private String constructionDetail;
 
+    @Schema(description = "定额时长(H)")
+    private BigDecimal allocatedTime;
+
+    @Schema(description = "定额时效(%)")
+    private BigDecimal allocatedEfficiency;
+
     @Schema(description = "工况")
     private String currentOperation;
 

+ 8 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotrydailyreportdetail/IotRyDailyReportDetailDO.java

@@ -82,6 +82,14 @@ public class IotRyDailyReportDetailDO extends BaseDO {
      * 工况
      */
     private String currentOperation;
+    /**
+     * 定额时长(H)
+     */
+    private BigDecimal allocatedTime;
+    /**
+     * 定额时效(%)
+     */
+    private BigDecimal allocatedEfficiency;
     /**
      * 排序值
      */

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrydailyreport/IotRyDailyReportServiceImpl.java

@@ -284,6 +284,12 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
                 if (ObjUtil.isNotEmpty(detail.getStartDateTime())) {
                     tempDetail.setReportDate(detail.getStartDateTime());
                 }
+                // 计算定额时效 = 1-((时长-定额时长)/定额时长)
+                if (ObjUtil.isNotEmpty(detail.getAllocatedTime()) && detail.getAllocatedTime().compareTo(BigDecimal.ZERO) > 0) {
+                    BigDecimal subtrahend = (detail.getDuration().subtract(detail.getAllocatedTime())).divide(detail.getAllocatedTime(), 2, RoundingMode.HALF_UP);
+                    BigDecimal minuend = new BigDecimal("1");
+                    tempDetail.setAllocatedEfficiency(minuend.subtract(subtrahend));
+                }
                 reportDOs.add(tempDetail);
             });
             // 插入日报明细记录