2026-06-06 15:52:29 +08:00
|
|
|
|
package com.klp.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import java.util.Arrays;
|
2026-06-09 17:08:01 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2026-06-06 15:52:29 +08:00
|
|
|
|
|
2026-06-09 17:08:01 +08:00
|
|
|
|
import com.klp.domain.bo.WmsMaterialCoilBo;
|
|
|
|
|
|
import com.klp.domain.vo.WmsMaterialCoilVo;
|
|
|
|
|
|
import com.klp.service.IWmsMaterialCoilService;
|
2026-06-06 15:52:29 +08:00
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import javax.validation.constraints.*;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|
|
|
|
|
import com.klp.common.annotation.Log;
|
|
|
|
|
|
import com.klp.common.core.controller.BaseController;
|
|
|
|
|
|
import com.klp.common.core.domain.PageQuery;
|
|
|
|
|
|
import com.klp.common.core.domain.R;
|
|
|
|
|
|
import com.klp.common.core.validate.AddGroup;
|
|
|
|
|
|
import com.klp.common.core.validate.EditGroup;
|
|
|
|
|
|
import com.klp.common.enums.BusinessType;
|
|
|
|
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
|
|
|
|
|
import com.klp.domain.vo.WmsMaterialWarningVo;
|
|
|
|
|
|
import com.klp.domain.bo.WmsMaterialWarningBo;
|
|
|
|
|
|
import com.klp.service.IWmsMaterialWarningService;
|
|
|
|
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 钢卷通用维度告警(长度/厚度/宽度)
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author klp
|
|
|
|
|
|
* @date 2026-06-06
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Validated
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
@RequestMapping("/wms/materialWarning")
|
|
|
|
|
|
public class WmsMaterialWarningController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
private final IWmsMaterialWarningService iWmsMaterialWarningService;
|
2026-06-09 17:08:01 +08:00
|
|
|
|
private final IWmsMaterialCoilService wmsMaterialCoilService;
|
2026-06-06 15:52:29 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询钢卷通用维度告警(长度/厚度/宽度)列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
|
public TableDataInfo<WmsMaterialWarningVo> list(WmsMaterialWarningBo bo, PageQuery pageQuery) {
|
2026-06-09 17:08:01 +08:00
|
|
|
|
TableDataInfo<WmsMaterialWarningVo> result = iWmsMaterialWarningService.queryPageList(bo, pageQuery);
|
|
|
|
|
|
// 收集所有钢卷ID,批量查询钢卷信息并填充
|
|
|
|
|
|
List<WmsMaterialWarningVo> list = result.getRows();
|
|
|
|
|
|
if (list != null && !list.isEmpty()) {
|
|
|
|
|
|
String coilIds = list.stream()
|
|
|
|
|
|
.map(WmsMaterialWarningVo::getCoilId)
|
|
|
|
|
|
.filter(java.util.Objects::nonNull)
|
|
|
|
|
|
.distinct()
|
|
|
|
|
|
.map(String::valueOf)
|
|
|
|
|
|
.collect(Collectors.joining(","));
|
|
|
|
|
|
if (!coilIds.isEmpty()) {
|
|
|
|
|
|
WmsMaterialCoilBo wmsMaterialCoilBo = new WmsMaterialCoilBo();
|
|
|
|
|
|
wmsMaterialCoilBo.setCoilIds(coilIds);
|
|
|
|
|
|
List<WmsMaterialCoilVo> coilVos = wmsMaterialCoilService.queryList(wmsMaterialCoilBo);
|
|
|
|
|
|
java.util.Map<Long, WmsMaterialCoilVo> coilMap = coilVos.stream()
|
|
|
|
|
|
.filter(v -> v.getCoilId() != null)
|
|
|
|
|
|
.collect(java.util.stream.Collectors.toMap(
|
|
|
|
|
|
WmsMaterialCoilVo::getCoilId,
|
|
|
|
|
|
v -> v,
|
|
|
|
|
|
(a, b) -> a));
|
|
|
|
|
|
for (WmsMaterialWarningVo warning : list) {
|
|
|
|
|
|
WmsMaterialCoilVo coilVo = coilMap.get(warning.getCoilId());
|
|
|
|
|
|
if (coilVo != null) {
|
|
|
|
|
|
warning.setCoilVo(coilVo);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
2026-06-06 15:52:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导出钢卷通用维度告警(长度/厚度/宽度)列表
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Log(title = "钢卷通用维度告警(长度/厚度/宽度)", businessType = BusinessType.EXPORT)
|
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
|
public void export(WmsMaterialWarningBo bo, HttpServletResponse response) {
|
|
|
|
|
|
List<WmsMaterialWarningVo> list = iWmsMaterialWarningService.queryList(bo);
|
2026-06-15 13:55:36 +08:00
|
|
|
|
ExcelUtil.exportExcel(list, "钢卷通用维度告警(长度、厚度、宽度)", WmsMaterialWarningVo.class, response);
|
2026-06-06 15:52:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取钢卷通用维度告警(长度/厚度/宽度)详细信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param warningId 主键
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("/{warningId}")
|
|
|
|
|
|
public R<WmsMaterialWarningVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
|
|
|
@PathVariable Long warningId) {
|
|
|
|
|
|
return R.ok(iWmsMaterialWarningService.queryById(warningId));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 新增钢卷通用维度告警(长度/厚度/宽度)
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Log(title = "钢卷通用维度告警(长度/厚度/宽度)", businessType = BusinessType.INSERT)
|
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
|
@PostMapping()
|
|
|
|
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsMaterialWarningBo bo) {
|
|
|
|
|
|
return toAjax(iWmsMaterialWarningService.insertByBo(bo));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 修改钢卷通用维度告警(长度/厚度/宽度)
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Log(title = "钢卷通用维度告警(长度/厚度/宽度)", businessType = BusinessType.UPDATE)
|
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
|
@PutMapping()
|
|
|
|
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsMaterialWarningBo bo) {
|
|
|
|
|
|
return toAjax(iWmsMaterialWarningService.updateByBo(bo));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 13:55:36 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 批量处理告警(填写处理人、处理时间、处理状态、处理备注)
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Log(title = "钢卷通用维度告警批量处理", businessType = BusinessType.UPDATE)
|
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
|
@PutMapping("/batchHandle")
|
|
|
|
|
|
public R<Void> batchHandle(@Validated @RequestBody WmsMaterialWarningBo bo) {
|
|
|
|
|
|
return toAjax(iWmsMaterialWarningService.batchHandle(bo));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-16 17:02:25 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 批量处理历史告警(标记今天以前的所有记录为指定状态)
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Log(title = "钢卷通用维度告警批量处理历史", businessType = BusinessType.UPDATE)
|
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
|
@PutMapping("/batchHandleHistory")
|
|
|
|
|
|
public R<Void> batchHandleHistory(@Validated @RequestBody WmsMaterialWarningBo bo) {
|
|
|
|
|
|
return toAjax(iWmsMaterialWarningService.batchHandleHistory(bo));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-06 15:52:29 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 删除钢卷通用维度告警(长度/厚度/宽度)
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param warningIds 主键串
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Log(title = "钢卷通用维度告警(长度/厚度/宽度)", businessType = BusinessType.DELETE)
|
|
|
|
|
|
@DeleteMapping("/{warningIds}")
|
|
|
|
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
|
|
|
@PathVariable Long[] warningIds) {
|
|
|
|
|
|
return toAjax(iWmsMaterialWarningService.deleteWithValidByIds(Arrays.asList(warningIds), true));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|