소스 검색

钢坯当班看板开发

qiangxuan 4 달 전
부모
커밋
6b21ff0ded

+ 5 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetLiftingBill/entity/BilletLiftingBill.java

@@ -118,4 +118,9 @@ public class BilletLiftingBill implements Serializable {
     @Excel(name = "吊运类型(0:热送,1:热装,2:堆垛)", width = 15)
     @ApiModelProperty(value = "吊运类型(0:热送,1:热装,2:堆垛)")
     private String liftingType;
+
+    /**坯重*/
+    @Excel(name = "坯重", width = 15)
+    @ApiModelProperty(value = "坯重",required = true)
+    private Double billetWeight;
 }

+ 29 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java

@@ -22,9 +22,7 @@ import org.jeecg.modules.billet.rollClubOne.entity.RollClubOneDetails;
 import org.jeecg.modules.billet.rollClubOne.service.IRollClubOneDetailsService;
 import org.jeecg.modules.billet.rollHeight.entity.RollHeightDetails;
 import org.jeecg.modules.billet.rollHeight.service.IRollHeightDetailsService;
-import org.jeecg.modules.billet.storageBill.entity.BilletHotsendDetails;
-import org.jeecg.modules.billet.storageBill.entity.OnDutyStatistics;
-import org.jeecg.modules.billet.storageBill.entity.StorageBill;
+import org.jeecg.modules.billet.storageBill.entity.*;
 import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
 import org.jeecg.modules.billet.storageCarLog.entity.StorageCarLog;
 import org.jeecg.modules.billet.storageCarLog.service.IStorageCarLogService;
@@ -480,4 +478,32 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 		}
 		return Result.OK((String) jsonObject.get("success"));
 	}
+
+	@ApiOperation(value="当班信息汇总-班次实绩", notes="当班信息汇总-班次实绩")
+	@GetMapping(value = "/queryOnDutyInfo")
+	public Result<OnDutyInfo> queryOnDutyInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
+		OnDutyInfo result = storageBillService.queryOnDutyInfoHandle(ccmNo);
+		return Result.OK(result);
+	}
+
+	@ApiOperation(value="当班行车吊运信息-班次实绩", notes="当班行车吊运信息-班次实绩")
+	@GetMapping(value = "/queryOnDutyLiftingBillInfo")
+	public Result<OnDutyLiftingBillInfo> queryOnDutyLiftingBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
+		OnDutyLiftingBillInfo onDutyLiftingBillInfo = storageBillService.queryOnDutyLiftingBillInfoHandle(ccmNo);
+		return Result.OK(onDutyLiftingBillInfo);
+	}
+
+	@ApiOperation(value="当班轧钢信息-班次实绩", notes="当班轧钢信息-班次实绩")
+	@GetMapping(value = "/queryOnDutySteelRollingInfo")
+	public Result<JSONObject> queryOnDutySteelRollingInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
+		JSONObject result = storageBillService.queryOnDutySteelRollingInfoHandle(ccmNo);
+		return Result.OK(result);
+	}
+
+	@ApiOperation(value="当班装运单信息-班次实绩", notes="当班装运单信息-班次实绩")
+	@GetMapping(value = "/queryOnDutyStorageBillInfo")
+	public Result<JSONObject> queryOnDutyStorageBillInfoHandle(@RequestParam(name="ccmNo") String ccmNo) {
+		JSONObject result = storageBillService.queryOnDutyStorageBillInfoHandle(ccmNo);
+		return Result.OK(result);
+	}
 }

+ 16 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/OnDutyInfo.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.billet.storageBill.entity;
+
+import lombok.Data;
+import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
+
+import java.math.BigDecimal;
+
+@Data
+public class OnDutyInfo {
+    // 交班信息
+    private BilletHotsendChangeShift billetHotsendChangeShift;
+    // 当班浇铸炉号总支数
+    private Integer currentCastingFurnaceAmount;
+    // 当班浇铸炉总重量
+    private BigDecimal currentCastingFurnace;
+}

+ 25 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/OnDutyLiftingBillDetails.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.billet.storageBill.entity;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class OnDutyLiftingBillDetails {
+
+    private Date changeShiftCreateTime;
+
+    private String vehicleNumber;
+
+    private Integer hotSendAmont;
+
+    private Double hotSendWeight;
+
+    private Integer hotChargingAmont;
+
+    private Double hotChargingWeight;
+
+    private Integer stackingAmont;
+
+    private Double AmontWeight;
+}

+ 12 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/OnDutyLiftingBillInfo.java

@@ -0,0 +1,12 @@
+package org.jeecg.modules.billet.storageBill.entity;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class OnDutyLiftingBillInfo {
+
+    private List<OnDutyLiftingBillDetails> onDutyLiftingBillDetailsList;
+
+}

+ 9 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/IStorageBillService.java

@@ -3,9 +3,7 @@ package org.jeecg.modules.billet.storageBill.service;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsendDetailsVo;
-import org.jeecg.modules.billet.storageBill.entity.BilletHotsendDetails;
-import org.jeecg.modules.billet.storageBill.entity.OnDutyStatistics;
-import org.jeecg.modules.billet.storageBill.entity.StorageBill;
+import org.jeecg.modules.billet.storageBill.entity.*;
 
 import java.util.List;
 import java.util.Map;
@@ -37,4 +35,12 @@ public interface IStorageBillService extends IService<StorageBill> {
     OnDutyStatistics queryOndutyStatistics(String ccmNo);
 
     JSONObject ondutyStatisticsExport(String ccmNo, String ondutyDate);
+
+    OnDutyInfo queryOnDutyInfoHandle(String ccmNo);
+
+    OnDutyLiftingBillInfo queryOnDutyLiftingBillInfoHandle(String ccmNo);
+
+    JSONObject queryOnDutySteelRollingInfoHandle(String ccmNo);
+
+    JSONObject queryOnDutyStorageBillInfoHandle(String ccmNo);
 }

+ 160 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

@@ -23,6 +23,8 @@ import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendCha
 import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
 import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
 import org.jeecg.modules.billet.billetHotsendConfig.service.IBilletHotsendTypeConfigService;
+import org.jeecg.modules.billet.billetLiftingBill.entity.BilletLiftingBill;
+import org.jeecg.modules.billet.billetLiftingBill.service.IBilletLiftingBillService;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.rollClubOne.entity.RollClubOneDetails;
 import org.jeecg.modules.billet.rollClubOne.service.IRollClubOneDetailsService;
@@ -55,6 +57,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
@@ -124,6 +127,9 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     @Resource
     private BilletHotsendBaseMapper billetHotsendBaseMapper;
 
+    @Autowired
+    private IBilletLiftingBillService billetLiftingBillService;
+
     @Override
     public void departHandle(BilletHotsendDetailsVo billetHotsendDetailsVo) {
         StorageBill storageBill = billetHotsendDetailsVo.getStorageBill();
@@ -1052,6 +1058,160 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         return result;
     }
 
+    @Override
+    public OnDutyInfo queryOnDutyInfoHandle(String ccmNo) {
+        log.info("{}{}", "查询当班信息开始!", ccmNo + "开始时间:"+new Date());
+
+        OnDutyInfo onDutyInfo = new OnDutyInfo();
+        // 从 Redis 获取班次信息
+        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+        String shift = getShiftInfo(ccmNo, "class:shift:%s");
+        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                .eq(BilletHotsendChangeShift::getShift, shift)
+                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                .last("limit 1");
+        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+        if (billetHotsendChangeShift == null){
+            log.info("{}{}", "查询当班信息失败,交班记录为空!", ccmNo+"失败时间:"+new Date());
+            return onDutyInfo;
+        }
+
+        // 根据铸机号、炉号、班组、班别、交班的创建时间,查询钢坯基础信息
+        LambdaQueryWrapper<BilletBasicInfo> queryWrapper2 = new LambdaQueryWrapper<>();
+        queryWrapper2.eq(BilletBasicInfo::getCcmNo, ccmNo)
+                .eq(BilletBasicInfo::getHeatNo, billetHotsendChangeShift.getHeatNo())
+                .eq(BilletBasicInfo::getShift, shift)
+                .eq(BilletBasicInfo::getShiftGroup, shiftGroup)
+                .between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        List<BilletBasicInfo> billetBasicInfoList2 = billetBasicInfoService.list(queryWrapper2);
+        if (oConvertUtils.listIsNotEmpty(billetBasicInfoList2)){
+            // 当班浇铸炉号总支数
+            onDutyInfo.setCurrentCastingFurnaceAmount(billetBasicInfoList2.size());
+            // 计算 billetWeight 的总和
+            double totalWeight = billetBasicInfoList2.stream()
+                    .mapToDouble(BilletBasicInfo::getBilletWeight)
+                    .sum();
+            // 保留 4 位小数
+            BigDecimal currentCastingFurnaceWeight = new BigDecimal(totalWeight).setScale(4, RoundingMode.HALF_UP);
+            // 当班浇铸炉总重量
+            onDutyInfo.setCurrentCastingFurnace(currentCastingFurnaceWeight);
+        }
+        return onDutyInfo;
+    }
+
+    @Override
+    public OnDutyLiftingBillInfo queryOnDutyLiftingBillInfoHandle(String ccmNo) {
+        OnDutyLiftingBillInfo onDutyLiftingBillInfo = new OnDutyLiftingBillInfo();
+        // 从 Redis 获取班次信息
+        String shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
+        String shift = getShiftInfo(ccmNo, "class:shift:%s");
+        // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
+        LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+                .eq(BilletHotsendChangeShift::getShift, shift)
+                .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+                .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+                .last("limit 1");
+        BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+        if (billetHotsendChangeShift == null){
+            log.info("{}{}", "查询当班行车吊运信息失败,交班记录为空!", ccmNo + "失败时间:" + new Date());
+            return onDutyLiftingBillInfo;
+        }
+        // 根据铸机号、班组、班别、交班的创建时间,查询当班行车吊运单信息,
+        LambdaQueryWrapper<BilletLiftingBill> queryWrapper2 = new LambdaQueryWrapper<>();
+        queryWrapper2.eq(BilletLiftingBill::getCcmNo, ccmNo)
+                .eq(BilletLiftingBill::getShift, shift)
+                .eq(BilletLiftingBill::getShiftGroup, shiftGroup)
+                .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date())
+                .groupBy(BilletLiftingBill::getVehicleNumber);
+        List<BilletLiftingBill> billetLiftingBillList = billetLiftingBillService.list(queryWrapper2);
+        if (oConvertUtils.listIsEmpty(billetLiftingBillList)){
+            log.info("{}{}", "查询当班行车吊运信息为空!", ccmNo + "失败时间:" + new Date());
+            return onDutyLiftingBillInfo;
+        }
+        List<String> vehicleNumberList = billetLiftingBillList.stream().map(BilletLiftingBill::getVehicleNumber).collect(Collectors.toList());
+
+        List<OnDutyLiftingBillDetails> allDetailsList = new ArrayList<>();
+        for (String vehicleNumber : vehicleNumberList) {
+            OnDutyLiftingBillDetails details = new OnDutyLiftingBillDetails();
+            details.setVehicleNumber(vehicleNumber);
+            details.setChangeShiftCreateTime(billetHotsendChangeShift.getCreateTime());
+            // 热送统计
+            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "0","hotSendAmont", "hotSendWeight");
+            // 热装统计
+            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "1","hotChargingAmont", "hotChargingWeight");
+            // 堆垛统计
+            countAndSet(details, billetHotsendChangeShift, ccmNo, shift, shiftGroup, vehicleNumber, "2","stackingAmont", "amontWeight");
+
+            allDetailsList.add(details);
+        }
+
+        onDutyLiftingBillInfo.setOnDutyLiftingBillDetailsList(allDetailsList);
+
+        return onDutyLiftingBillInfo;
+    }
+
+    private void countAndSet(OnDutyLiftingBillDetails details, BilletHotsendChangeShift billetHotsendChangeShift,
+                                    String ccmNo, String shift, String shiftGroup, String vehicleNumber,
+                                    String liftingType, String amountField, String weightField) {
+        LambdaQueryWrapper<BilletLiftingBill> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(BilletLiftingBill::getCcmNo, ccmNo)
+                .eq(BilletLiftingBill::getShift, shift)
+                .eq(BilletLiftingBill::getShiftGroup, shiftGroup)
+                .eq(BilletLiftingBill::getVehicleNumber, vehicleNumber)
+                .eq(BilletLiftingBill::getLiftingType, liftingType)
+                .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+
+        List<BilletLiftingBill> billList = billetLiftingBillService.list(queryWrapper);
+        int amount;
+        double weight;
+        if (oConvertUtils.listIsNotEmpty(billList)) {
+            amount = billList.size() * 4;
+            weight = billList.stream().mapToDouble(BilletLiftingBill::getBilletWeight).sum();
+        } else {
+            amount = 0;
+            weight = 0;
+        }
+        switch (amountField) {
+            case "hotSendAmont":
+                details.setHotSendAmont(amount);
+                details.setHotSendWeight(weight);
+                break;
+            case "hotChargingAmont":
+                details.setHotChargingAmont(amount);
+                details.setHotChargingWeight(weight);
+                break;
+            case "stackingAmont":
+                details.setStackingAmont(amount);
+                details.setAmontWeight(weight);
+                break;
+        }
+    }
+
+    @Override
+    public JSONObject queryOnDutySteelRollingInfoHandle(String ccmNo) {
+        JSONObject result = new JSONObject();
+
+
+
+
+        return result;
+    }
+
+    @Override
+    public JSONObject queryOnDutyStorageBillInfoHandle(String ccmNo) {
+        JSONObject result = new JSONObject();
+
+
+
+
+        return result;
+    }
+
+
 
     /**
      * 生成综合唯一编码