|
@@ -1,5 +1,11 @@
|
|
package org.jeecg.modules.billet.billetOriginalProductRecord.controller;
|
|
package org.jeecg.modules.billet.billetOriginalProductRecord.controller;
|
|
-
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.math.RoundingMode;
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -49,14 +55,6 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
-import java.math.RoundingMode;
|
|
|
|
-import java.text.DecimalFormat;
|
|
|
|
-import java.util.*;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* @Description: 钢坯生成原始记录
|
|
* @Description: 钢坯生成原始记录
|
|
* @Author: jeecg-boot
|
|
* @Author: jeecg-boot
|
|
@@ -338,7 +336,6 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
positionLog.append(p.getLayer()).append(".").append(p.getAddress()).append(" → "));
|
|
positionLog.append(p.getLayer()).append(".").append(p.getAddress()).append(" → "));
|
|
log.info(positionLog.substring(0, positionLog.length() - 4)); // 移除最后的" → "
|
|
log.info(positionLog.substring(0, positionLog.length() - 4)); // 移除最后的" → "
|
|
}
|
|
}
|
|
-
|
|
|
|
if (availablePositions.isEmpty()) {
|
|
if (availablePositions.isEmpty()) {
|
|
log.info("无法计算出可用位置,起垛失败!heatNo={}", heatNo);
|
|
log.info("无法计算出可用位置,起垛失败!heatNo={}", heatNo);
|
|
return;
|
|
return;
|
|
@@ -427,20 +424,32 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
public Result<String> addStorageBillHandle(@RequestParam(name="ccmNo",required = false) String ccmNo,
|
|
public Result<String> addStorageBillHandle(@RequestParam(name="ccmNo",required = false) String ccmNo,
|
|
@RequestParam(name="positionNum",required = true) Integer positionNum,
|
|
@RequestParam(name="positionNum",required = true) Integer positionNum,
|
|
@RequestParam(name="licensePlate",required = true) String licensePlate) {
|
|
@RequestParam(name="licensePlate",required = true) String licensePlate) {
|
|
|
|
+ // 参数验证
|
|
|
|
+ if (positionNum == 2 && StringUtils.isEmpty(ccmNo)) {
|
|
|
|
+ return Result.error("车位2铸机号不能为空!");
|
|
|
|
+ }
|
|
|
|
+
|
|
StorageBill storageBill = new StorageBill();
|
|
StorageBill storageBill = new StorageBill();
|
|
storageBill.setId(String.valueOf(IdWorker.getId()));
|
|
storageBill.setId(String.valueOf(IdWorker.getId()));
|
|
- storageBill.setPositionNum(positionNum);
|
|
|
|
- storageBill.setLicensePlate(licensePlate);
|
|
|
|
- if (positionNum == 1){
|
|
|
|
- storageBill.setCcmNo("5");
|
|
|
|
- }else if (positionNum == 2){
|
|
|
|
- storageBill.setCcmNo(ccmNo);
|
|
|
|
- }else if (positionNum == 3 || positionNum == 4){
|
|
|
|
- storageBill.setCcmNo("6");
|
|
|
|
|
|
+ // 确定最终的ccmNo
|
|
|
|
+ String finalCcmNo;
|
|
|
|
+ if (positionNum == 1) {
|
|
|
|
+ finalCcmNo = "5";
|
|
|
|
+ } else if (positionNum == 2) {
|
|
|
|
+ finalCcmNo = ccmNo;
|
|
|
|
+ } else if (positionNum == 3 || positionNum == 4) {
|
|
|
|
+ finalCcmNo = "6";
|
|
|
|
+ } else {
|
|
|
|
+ return Result.error("无效的车位号!");
|
|
}
|
|
}
|
|
|
|
+ storageBill.setCcmNo(finalCcmNo);
|
|
// 从 Redis 获取班次信息
|
|
// 从 Redis 获取班次信息
|
|
String shiftGroup = getShiftInfo(storageBill.getCcmNo(), "class:shift:group:%s");
|
|
String shiftGroup = getShiftInfo(storageBill.getCcmNo(), "class:shift:group:%s");
|
|
String shift = getShiftInfo(storageBill.getCcmNo(), "class:shift:%s");
|
|
String shift = getShiftInfo(storageBill.getCcmNo(), "class:shift:%s");
|
|
|
|
+ // 空值检查
|
|
|
|
+ if (shiftGroup == null || shift == null) {
|
|
|
|
+ return Result.error("班组、班别不存在,创建失败!");
|
|
|
|
+ }
|
|
// 判断车牌号是否存在未发车的装运单信息
|
|
// 判断车牌号是否存在未发车的装运单信息
|
|
LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
|
|
queryWrapper.eq(StorageBill::getLicensePlate, licensePlate)
|
|
queryWrapper.eq(StorageBill::getLicensePlate, licensePlate)
|
|
@@ -450,20 +459,20 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
StorageBill isStorageBill = storageBillService.getOne(queryWrapper);
|
|
StorageBill isStorageBill = storageBillService.getOne(queryWrapper);
|
|
if (oConvertUtils.isNotEmpty(isStorageBill)) {
|
|
if (oConvertUtils.isNotEmpty(isStorageBill)) {
|
|
log.info("推钢室查询到存在未发车车辆,车牌号为:{},新增钢坯装运单失败!", storageBill.getLicensePlate());
|
|
log.info("推钢室查询到存在未发车车辆,车牌号为:{},新增钢坯装运单失败!", storageBill.getLicensePlate());
|
|
- return Result.error("该车存在未发车信息,操作失败!");
|
|
|
|
|
|
+ return Result.error("该车存在未发车信息,创建失败!");
|
|
}
|
|
}
|
|
// 判断车位是否存在未发车车辆(2025/3.3,半自动化逻辑,等自动化发车车位发车完善后,在添加此段逻辑)
|
|
// 判断车位是否存在未发车车辆(2025/3.3,半自动化逻辑,等自动化发车车位发车完善后,在添加此段逻辑)
|
|
List<StorageBill> storageBillList = storageBillService.list(new LambdaQueryWrapper<StorageBill>()
|
|
List<StorageBill> storageBillList = storageBillService.list(new LambdaQueryWrapper<StorageBill>()
|
|
- .eq(StorageBill::getPositionNum, storageBill.getPositionNum())
|
|
|
|
|
|
+ .eq(StorageBill::getPositionNum, positionNum)
|
|
.isNull(StorageBill::getOutTime));
|
|
.isNull(StorageBill::getOutTime));
|
|
if (oConvertUtils.listIsNotEmpty(storageBillList)){
|
|
if (oConvertUtils.listIsNotEmpty(storageBillList)){
|
|
log.info("{}{}", "推钢室该车位存在未发车信息,新增钢坯装运单失败!", JSON.toJSON(storageBillList));
|
|
log.info("{}{}", "推钢室该车位存在未发车信息,新增钢坯装运单失败!", JSON.toJSON(storageBillList));
|
|
- return Result.error("该车位存在未发车信息,操作失败!");
|
|
|
|
|
|
+ return Result.error("该车位存在未发车信息,创建失败!");
|
|
}
|
|
}
|
|
|
|
|
|
// 根据铸机号、班组、班别,创建时间倒序 只返回一条,查询储运配置信息
|
|
// 根据铸机号、班组、班别,创建时间倒序 只返回一条,查询储运配置信息
|
|
LambdaQueryWrapper<ShiftConfiguration> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ShiftConfiguration> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
- queryWrapper1.eq(ShiftConfiguration::getCcmNo, ccmNo)
|
|
|
|
|
|
+ queryWrapper1.eq(ShiftConfiguration::getCcmNo, storageBill.getCcmNo())
|
|
.eq(ShiftConfiguration::getShiftGroup, shiftGroup)
|
|
.eq(ShiftConfiguration::getShiftGroup, shiftGroup)
|
|
.eq(ShiftConfiguration::getShift, shift)
|
|
.eq(ShiftConfiguration::getShift, shift)
|
|
.orderByDesc(ShiftConfiguration::getCreateTime)
|
|
.orderByDesc(ShiftConfiguration::getCreateTime)
|
|
@@ -481,7 +490,8 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
storageBill.setArrivalTime(new Date());// 到达时间
|
|
storageBill.setArrivalTime(new Date());// 到达时间
|
|
// 更新交班记录 通过铸机号、班组、班别去查询交班记录并初始化 出车号
|
|
// 更新交班记录 通过铸机号、班组、班别去查询交班记录并初始化 出车号
|
|
updateBilletHotsendChangeShift(storageBill.getCcmNo(), shiftGroup, shift);
|
|
updateBilletHotsendChangeShift(storageBill.getCcmNo(), shiftGroup, shift);
|
|
-
|
|
|
|
|
|
+ storageBill.setPositionNum(positionNum);
|
|
|
|
+ storageBill.setLicensePlate(licensePlate);
|
|
storageBill.setAmountTotal(0);
|
|
storageBill.setAmountTotal(0);
|
|
storageBill.setPanelAmountTotal(0);
|
|
storageBill.setPanelAmountTotal(0);
|
|
storageBill.setShiftGroup(shiftGroup);
|
|
storageBill.setShiftGroup(shiftGroup);
|
|
@@ -494,7 +504,7 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
storageBill.setBtype("0");
|
|
storageBill.setBtype("0");
|
|
storageBillService.save(storageBill);
|
|
storageBillService.save(storageBill);
|
|
|
|
|
|
- return Result.OK("操作成功!");
|
|
|
|
|
|
+ return Result.OK("创建成功!");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -602,6 +612,10 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
}else {
|
|
}else {
|
|
billetHotsendChangeShift = billetHotsendChangeShiftService.getById(changeShiftId);
|
|
billetHotsendChangeShift = billetHotsendChangeShiftService.getById(changeShiftId);
|
|
}
|
|
}
|
|
|
|
+ if (billetHotsendChangeShift == null) {
|
|
|
|
+ log.error("未查询到有效的交班记录,无法继续处理");
|
|
|
|
+ return Result.error("未找到对应的交班信息,原始生产记录获取失败!");
|
|
|
|
+ }
|
|
//1、 获取当班浇筑炉次详细信息
|
|
//1、 获取当班浇筑炉次详细信息
|
|
List<HeatsActualsInfo> heatsActualsInfoList = queryCurrentHeatsActualsInfo(ccmNo, billetHotsendChangeShift.getShift(), billetHotsendChangeShift.getShiftGroup(), billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime(), queryType);
|
|
List<HeatsActualsInfo> heatsActualsInfoList = queryCurrentHeatsActualsInfo(ccmNo, billetHotsendChangeShift.getShift(), billetHotsendChangeShift.getShiftGroup(), billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime(), queryType);
|
|
log.info("原始生产记录,当班浇筑炉次数据信息: " + JSON.toJSON(heatsActualsInfoList));
|
|
log.info("原始生产记录,当班浇筑炉次数据信息: " + JSON.toJSON(heatsActualsInfoList));
|
|
@@ -2373,7 +2387,7 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
.last("limit 1");
|
|
.last("limit 1");
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
if (oConvertUtils.isEmpty(billetHotsendChangeShift)) {
|
|
if (oConvertUtils.isEmpty(billetHotsendChangeShift)) {
|
|
- log.info("手动创建装运单交班记录不存在,车次数维护失败:{}", ccmNo+shiftGroup+shift);
|
|
|
|
|
|
+ log.info("推钢室界面创建装运单交班记录不存在,车次数维护失败:{}", ccmNo+shiftGroup+shift);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
billetHotsendChangeShift.setOutCarNum(billetHotsendChangeShift.getOutCarNum() + 1);
|
|
billetHotsendChangeShift.setOutCarNum(billetHotsendChangeShift.getOutCarNum() + 1);
|