|
@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.commons.lang.time.DateFormatUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
@@ -103,6 +104,9 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
@Autowired
|
|
|
private IShiftConfigurationService shiftConfigurationService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IBilletHotsendBaseService billetHotsendService;
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -658,9 +662,41 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
*/
|
|
|
@AutoLog(value = "钢坯生成原始记录-通过id删除")
|
|
|
@ApiOperation(value="钢坯生成原始记录-通过id删除", notes="钢坯生成原始记录-通过id删除")
|
|
|
- @RequiresPermissions("billetOriginalProductRecord:billet_original_product_record:delete")
|
|
|
+// @RequiresPermissions("billetOriginalProductRecord:billet_original_product_record:delete")
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
+ // 查询原始记录
|
|
|
+ BilletOriginalProductRecord record = billetOriginalProductRecordService.getById(id);
|
|
|
+ if (record == null) {
|
|
|
+ return Result.error("数据不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ String ccmNo = record.getCcmNo();
|
|
|
+ String shift = record.getShift();
|
|
|
+ String shiftGroup = record.getShiftGroup();
|
|
|
+ String heatNo = record.getHeatNo();
|
|
|
+ String recordDateStr = DateFormatUtils.format(record.getCreateTime(), "yyyy-MM-dd");
|
|
|
+
|
|
|
+ // 查询创建时间最新的 BilletHotsend 记录
|
|
|
+ LambdaQueryWrapper<BilletHotsend> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletHotsend::getCcmNo, ccmNo)
|
|
|
+ .eq(BilletHotsend::getShift, shift)
|
|
|
+ .eq(BilletHotsend::getShiftGroup, shiftGroup)
|
|
|
+ .eq(BilletHotsend::getHeatNo, heatNo)
|
|
|
+ .orderByDesc(BilletHotsend::getCreateTime)
|
|
|
+ .last("limit 1");
|
|
|
+
|
|
|
+ BilletHotsend hotsend = billetHotsendService.getOne(queryWrapper);
|
|
|
+ if (hotsend != null) {
|
|
|
+ String hotsendDateStr = DateFormatUtils.format(hotsend.getCreateTime(), "yyyy-MM-dd");
|
|
|
+ if (recordDateStr.equals(hotsendDateStr)) {
|
|
|
+ BilletHotsend updateEntity = new BilletHotsend();
|
|
|
+ updateEntity.setId(hotsend.getId());
|
|
|
+ updateEntity.setDeleteStatus(1); // 只更新 deleteStatus 字段
|
|
|
+ billetHotsendService.updateById(updateEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
billetOriginalProductRecordService.removeById(id);
|
|
|
return Result.OK("删除成功!");
|
|
|
}
|
|
@@ -1061,6 +1097,12 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
}else {
|
|
|
queryWrapper1.between(BilletHotsend::getCreateTime, shiftStartTime, shiftEndTime);
|
|
|
}
|
|
|
+ //过滤从原始记录中删除的炉号
|
|
|
+ queryWrapper1.and(wrapper ->
|
|
|
+ wrapper.ne(BilletHotsend::getDeleteStatus, 1)
|
|
|
+ .or()
|
|
|
+ .isNull(BilletHotsend::getDeleteStatus)
|
|
|
+ );
|
|
|
queryWrapper1.orderByDesc(BilletHotsend::getCreateTime);
|
|
|
List<BilletHotsend> billetHotsendList = billetHotsendBaseService.list(queryWrapper1);
|
|
|
if (oConvertUtils.listIsEmpty(billetHotsendList)){
|