- 在 IWmsDeliveryWaybillDetailService 中新增 getBoundCoilIds 方法 - 在 WmsDeliveryWaybillDetailController 中新增 boundCoilList 接口 - 实现 WmsDeliveryWaybillDetailServiceImpl 的 getBoundCoilIds 查询逻辑 - 集成 WmsMaterialCoilService 查询已发货绑定的钢卷信息 - 添加钢卷 ID 去重处理确保数据准确性 - 支持分页查询返回 TableDataInfo 格式数据
127 lines
4.5 KiB
Java
127 lines
4.5 KiB
Java
package com.klp.controller;
|
|
|
|
import java.util.List;
|
|
import java.util.Arrays;
|
|
|
|
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.WmsDeliveryWaybillDetailVo;
|
|
import com.klp.domain.bo.WmsDeliveryWaybillDetailBo;
|
|
import com.klp.service.IWmsDeliveryWaybillDetailService;
|
|
import com.klp.domain.vo.WmsMaterialCoilVo;
|
|
import com.klp.domain.bo.WmsMaterialCoilBo;
|
|
import com.klp.service.IWmsMaterialCoilService;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* 发货单明细
|
|
*
|
|
* @author klp
|
|
* @date 2025-11-25
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/wms/deliveryWaybillDetail")
|
|
public class WmsDeliveryWaybillDetailController extends BaseController {
|
|
|
|
private final IWmsDeliveryWaybillDetailService iWmsDeliveryWaybillDetailService;
|
|
private final IWmsMaterialCoilService iWmsMaterialCoilService;
|
|
|
|
/**
|
|
* 查询发货单明细列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public TableDataInfo<WmsDeliveryWaybillDetailVo> list(WmsDeliveryWaybillDetailBo bo, PageQuery pageQuery) {
|
|
return iWmsDeliveryWaybillDetailService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出发货单明细列表
|
|
*/
|
|
@Log(title = "发货单明细", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsDeliveryWaybillDetailBo bo, HttpServletResponse response) {
|
|
List<WmsDeliveryWaybillDetailVo> list = iWmsDeliveryWaybillDetailService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "发货单明细", WmsDeliveryWaybillDetailVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取发货单明细详细信息
|
|
*
|
|
* @param detailId 主键
|
|
*/
|
|
@GetMapping("/{detailId}")
|
|
public R<WmsDeliveryWaybillDetailVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long detailId) {
|
|
return R.ok(iWmsDeliveryWaybillDetailService.queryById(detailId));
|
|
}
|
|
|
|
/**
|
|
* 新增发货单明细
|
|
*/
|
|
@Log(title = "发货单明细", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsDeliveryWaybillDetailBo bo) {
|
|
return toAjax(iWmsDeliveryWaybillDetailService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 批量新增发货单明细
|
|
*/
|
|
@Log(title = "发货单明细", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping("/batch")
|
|
public R<Void> batchAdd(@Validated(AddGroup.class) @RequestBody List<WmsDeliveryWaybillDetailBo> boList) {
|
|
return toAjax(iWmsDeliveryWaybillDetailService.insertBatchByBo(boList));
|
|
}
|
|
|
|
/**
|
|
* 修改发货单明细
|
|
*/
|
|
@Log(title = "发货单明细", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsDeliveryWaybillDetailBo bo) {
|
|
return toAjax(iWmsDeliveryWaybillDetailService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除发货单明细
|
|
*
|
|
* @param detailIds 主键串
|
|
*/
|
|
@Log(title = "发货单明细", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{detailIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] detailIds) {
|
|
return toAjax(iWmsDeliveryWaybillDetailService.deleteWithValidByIds(Arrays.asList(detailIds), true));
|
|
}
|
|
|
|
/**
|
|
* 查询已发货绑定的钢卷列表
|
|
*/
|
|
@GetMapping("/boundCoilList")
|
|
public TableDataInfo<WmsMaterialCoilVo> boundCoilList(WmsMaterialCoilBo bo, PageQuery pageQuery) {
|
|
List<Long> boundCoilIds = iWmsDeliveryWaybillDetailService.getBoundCoilIds();
|
|
if (boundCoilIds == null || boundCoilIds.isEmpty()) {
|
|
return new TableDataInfo<>();
|
|
}
|
|
bo.setCoilIds(boundCoilIds.stream().map(String::valueOf).collect(java.util.stream.Collectors.joining(",")));
|
|
return iWmsMaterialCoilService.queryPageList(bo, pageQuery);
|
|
}
|
|
}
|