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.WmsDeliveryWaybillVo; import com.klp.domain.bo.WmsDeliveryWaybillBo; import com.klp.service.IWmsDeliveryWaybillService; import com.klp.common.core.page.TableDataInfo; /** * 发货单主 * * @author klp * @date 2025-11-25 */ @Validated @RequiredArgsConstructor @RestController @RequestMapping("/wms/deliveryWaybill") public class WmsDeliveryWaybillController extends BaseController { private final IWmsDeliveryWaybillService iWmsDeliveryWaybillService; /** * 查询发货单主列表 */ @GetMapping("/list") public TableDataInfo list(WmsDeliveryWaybillBo bo, PageQuery pageQuery) { return iWmsDeliveryWaybillService.queryPageList(bo, pageQuery); } /** * 导出发货单主列表 */ @Log(title = "发货单主", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(WmsDeliveryWaybillBo bo, HttpServletResponse response) { List list = iWmsDeliveryWaybillService.queryList(bo); ExcelUtil.exportExcel(list, "发货单主", WmsDeliveryWaybillVo.class, response); } /** * 获取发货单主详细信息 * * @param waybillId 主键 */ @GetMapping("/{waybillId}") public R getInfo(@NotNull(message = "主键不能为空") @PathVariable Long waybillId) { return R.ok(iWmsDeliveryWaybillService.queryById(waybillId)); } /** * 新增发货单主 */ @Log(title = "发货单主", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() public R add(@Validated(AddGroup.class) @RequestBody WmsDeliveryWaybillBo bo) { return toAjax(iWmsDeliveryWaybillService.insertByBo(bo)); } /** * 修改发货单主 */ @Log(title = "发货单主", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody WmsDeliveryWaybillBo bo) { return toAjax(iWmsDeliveryWaybillService.updateByBo(bo)); } // 修改发货单状态 @Log(title = "发货单主", businessType = BusinessType.UPDATE) @PutMapping("/status") public R changeStatus(@RequestBody WmsDeliveryWaybillBo bo) { return toAjax(iWmsDeliveryWaybillService.changeStatus(bo)); } /** * 删除发货单主 * * @param waybillIds 主键串 */ @Log(title = "发货单主", businessType = BusinessType.DELETE) @DeleteMapping("/{waybillIds}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] waybillIds) { return toAjax(iWmsDeliveryWaybillService.deleteWithValidByIds(Arrays.asList(waybillIds), true)); } }