|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 生成综合唯一编码
|