feat(erp): 采购计划/采购审核/到货跟踪 + 供应商管理
- 采购计划:选合同自动带出明细、合同/供应商表格选择器、批量填充(可生成N行)、卷号/数量列、送审/重新送审流程 - 采购审核:通过/驳回 + 申请意见,每次审核留痕(erp_purchase_plan_audit_log),计划详情展示审核历史/驳回理由 - 到货跟踪:上传到货Excel按牌号+规格回填明细到货量与状态,列校验/kg→t纠正,满额自动归档 - 供应商管理页(复用既有 erp_supplier 后端) - 综合搜索(计划号/供货商/合同号)、左右分栏工作台、全局表单按钮对齐修复 - 清理无用旧 erp 页面(看板/需求/订单/收货/退货/汇总) - DDL 与菜单脚本:docs/purchase-plan-ddl.sql(按 path 解析父目录、可重复执行) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
package com.klp.erp.controller;
|
||||
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
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.page.TableDataInfo;
|
||||
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.erp.domain.bo.ErpPurchasePlanAuditBo;
|
||||
import com.klp.erp.domain.bo.ErpPurchasePlanBo;
|
||||
import com.klp.erp.domain.vo.ErpContractOptionVo;
|
||||
import com.klp.erp.domain.vo.ErpPurchasePlanDeliveryVo;
|
||||
import com.klp.erp.domain.vo.ErpPurchasePlanItemVo;
|
||||
import com.klp.erp.domain.vo.ErpPurchasePlanVo;
|
||||
import com.klp.erp.service.IErpPurchasePlanService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 采购计划
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-22
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/erp/purchasePlan")
|
||||
public class ErpPurchasePlanController extends BaseController {
|
||||
|
||||
private final IErpPurchasePlanService iErpPurchasePlanService;
|
||||
|
||||
/** 查询采购计划列表 */
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ErpPurchasePlanVo> list(ErpPurchasePlanBo bo, PageQuery pageQuery) {
|
||||
return iErpPurchasePlanService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/** 总体到货进度统计(已完成 N / 共 M) */
|
||||
@GetMapping("/statistics")
|
||||
public R<Map<String, Object>> statistics(ErpPurchasePlanBo bo) {
|
||||
return R.ok(iErpPurchasePlanService.statistics(bo));
|
||||
}
|
||||
|
||||
/** 导出采购计划列表 */
|
||||
@Log(title = "采购计划", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ErpPurchasePlanBo bo, HttpServletResponse response) {
|
||||
List<ErpPurchasePlanVo> list = iErpPurchasePlanService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "采购计划", ErpPurchasePlanVo.class, response);
|
||||
}
|
||||
|
||||
/** 获取采购计划详细信息 */
|
||||
@GetMapping("/{planId}")
|
||||
public R<ErpPurchasePlanVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long planId) {
|
||||
return R.ok(iErpPurchasePlanService.queryById(planId));
|
||||
}
|
||||
|
||||
/** 按销售合同取明细(选合同自动带出明细:1/2/3合同 -> 1/2/3/4明细) */
|
||||
@GetMapping("/itemsByOrders")
|
||||
public R<List<ErpPurchasePlanItemVo>> itemsByOrders(@RequestParam("orderIds") List<Long> orderIds) {
|
||||
return R.ok(iErpPurchasePlanService.queryItemsByOrders(orderIds));
|
||||
}
|
||||
|
||||
/** 合同列表(左侧):crm_order + 每个合同已有的采购计划数 */
|
||||
@GetMapping("/contracts")
|
||||
public TableDataInfo<ErpContractOptionVo> contracts(@RequestParam(value = "keyword", required = false) String keyword,
|
||||
PageQuery pageQuery) {
|
||||
return iErpPurchasePlanService.queryContractPage(keyword, pageQuery);
|
||||
}
|
||||
|
||||
/** 某合同下的所有采购计划 */
|
||||
@GetMapping("/byContract/{orderId}")
|
||||
public R<List<ErpPurchasePlanVo>> byContract(@PathVariable Long orderId) {
|
||||
return R.ok(iErpPurchasePlanService.queryPlansByContract(orderId));
|
||||
}
|
||||
|
||||
/** 新增采购计划 */
|
||||
@Log(title = "采购计划", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ErpPurchasePlanBo bo) {
|
||||
return toAjax(iErpPurchasePlanService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/** 修改采购计划 */
|
||||
@Log(title = "采购计划", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ErpPurchasePlanBo bo) {
|
||||
return toAjax(iErpPurchasePlanService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/** 审核(通过/驳回 + 申请意见) */
|
||||
@Log(title = "采购计划", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/audit")
|
||||
public R<Void> audit(@Validated @RequestBody ErpPurchasePlanAuditBo bo) {
|
||||
return toAjax(iErpPurchasePlanService.audit(bo, getUsername()));
|
||||
}
|
||||
|
||||
/** 送审 / 重新送审 */
|
||||
@Log(title = "采购计划", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/submit/{planId}")
|
||||
public R<Void> submit(@NotNull(message = "主键不能为空") @PathVariable Long planId) {
|
||||
return toAjax(iErpPurchasePlanService.submitForAudit(planId));
|
||||
}
|
||||
|
||||
/** 删除采购计划 */
|
||||
@Log(title = "采购计划", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{planIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] planIds) {
|
||||
return toAjax(iErpPurchasePlanService.deleteWithValidByIds(Arrays.asList(planIds), true));
|
||||
}
|
||||
|
||||
/** 导入到货 Excel */
|
||||
@Log(title = "采购计划-到货", businessType = BusinessType.IMPORT)
|
||||
@PostMapping(value = "/{planId}/importDelivery", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Map<String, Object>> importDelivery(@PathVariable Long planId,
|
||||
@RequestPart("file") MultipartFile file) throws Exception {
|
||||
Map<String, Object> result = iErpPurchasePlanService.importDelivery(planId, file.getInputStream(), getUsername());
|
||||
return R.ok(String.valueOf(result.get("message")), result);
|
||||
}
|
||||
|
||||
/** 查询某计划的到货明细 */
|
||||
@GetMapping("/{planId}/delivery")
|
||||
public R<List<ErpPurchasePlanDeliveryVo>> deliveryList(@PathVariable Long planId) {
|
||||
return R.ok(iErpPurchasePlanService.queryDeliveryList(planId));
|
||||
}
|
||||
|
||||
/** 删除到货明细 */
|
||||
@Log(title = "采购计划-到货", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delivery/{deliveryId}")
|
||||
public R<Void> deleteDelivery(@PathVariable Long deliveryId) {
|
||||
return toAjax(iErpPurchasePlanService.deleteDelivery(deliveryId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user