完成排产(测试过了)

This commit is contained in:
2026-03-08 16:02:44 +08:00
parent b660ddcc3e
commit 7736ac3311
125 changed files with 10418 additions and 15 deletions

View File

@@ -0,0 +1,93 @@
package com.klp.aps.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.aps.domain.bo.ApsCalendarBo;
import com.klp.aps.domain.vo.ApsCalendarVo;
import com.klp.aps.service.ApsCalendarService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 工厂日历Controller
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/calendar")
public class ApsCalendarController extends BaseController {
private final ApsCalendarService apsCalendarService;
/**
* 查询工厂日历列表
*/
@GetMapping("/list")
public TableDataInfo<ApsCalendarVo> list(ApsCalendarBo bo, PageQuery pageQuery) {
return apsCalendarService.queryPageList(bo, pageQuery);
}
/**
* 导出工厂日历列表
*/
@Log(title = "工厂日历", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ApsCalendarBo bo, HttpServletResponse response) {
List<ApsCalendarVo> list = apsCalendarService.queryList(bo);
ExcelUtil.exportExcel(list, "工厂日历", ApsCalendarVo.class, response);
}
/**
* 获取工厂日历详细信息
*/
@GetMapping("/{calendarId}")
public R<ApsCalendarVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long calendarId) {
return R.ok(apsCalendarService.queryById(calendarId));
}
/**
* 新增工厂日历
*/
@Log(title = "工厂日历", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ApsCalendarBo bo) {
return toAjax(apsCalendarService.insertByBo(bo));
}
/**
* 修改工厂日历
*/
@Log(title = "工厂日历", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ApsCalendarBo bo) {
return toAjax(apsCalendarService.updateByBo(bo));
}
/**
* 删除工厂日历
*/
@Log(title = "工厂日历", businessType = BusinessType.DELETE)
@DeleteMapping("/{calendarIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] calendarIds) {
return toAjax(apsCalendarService.deleteWithValidByIds(Arrays.asList(calendarIds), true));
}
}

View File

@@ -0,0 +1,103 @@
package com.klp.aps.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.aps.domain.bo.ApsCalendarShiftBo;
import com.klp.aps.domain.vo.ApsCalendarShiftVo;
import com.klp.aps.service.ApsCalendarShiftService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 日历班次配置Controller
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/calendar-shift")
public class ApsCalendarShiftController extends BaseController {
private final ApsCalendarShiftService apsCalendarShiftService;
/**
* 查询日历班次配置列表
*/
@GetMapping("/list")
public TableDataInfo<ApsCalendarShiftVo> list(ApsCalendarShiftBo bo, PageQuery pageQuery) {
return apsCalendarShiftService.queryPageList(bo, pageQuery);
}
/**
* 导出日历班次配置列表
*/
@Log(title = "日历班次配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ApsCalendarShiftBo bo, HttpServletResponse response) {
List<ApsCalendarShiftVo> list = apsCalendarShiftService.queryList(bo);
ExcelUtil.exportExcel(list, "日历班次配置", ApsCalendarShiftVo.class, response);
}
/**
* 获取日历班次配置详细信息
*/
@GetMapping("/{configId}")
public R<ApsCalendarShiftVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long configId) {
return R.ok(apsCalendarShiftService.queryById(configId));
}
/**
* 新增日历班次配置
*/
@Log(title = "日历班次配置", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ApsCalendarShiftBo bo) {
return toAjax(apsCalendarShiftService.insertByBo(bo));
}
/**
* 修改日历班次配置
*/
@Log(title = "日历班次配置", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ApsCalendarShiftBo bo) {
return toAjax(apsCalendarShiftService.updateByBo(bo));
}
/**
* 删除日历班次配置
*/
@Log(title = "日历班次配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] configIds) {
return toAjax(apsCalendarShiftService.deleteWithValidByIds(Arrays.asList(configIds), true));
}
/**
* 一键生成全年工作日日历
*/
@Log(title = "日历班次配置", businessType = BusinessType.INSERT)
@PostMapping("/generate-workday-year/{year}")
public R<Integer> generateWorkdayYear(@PathVariable Integer year,
@RequestParam(value = "overwriteExisting", required = false, defaultValue = "false") Boolean overwriteExisting) {
return R.ok(apsCalendarShiftService.generateWorkdayForYear(year, overwriteExisting));
}
}

View File

@@ -0,0 +1,45 @@
package com.klp.aps.controller;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.aps.domain.dto.ApsGanttQueryReq;
import com.klp.aps.domain.vo.ApsFactoryCalendarRespVo;
import com.klp.aps.domain.vo.ApsGanttItemVo;
import com.klp.aps.service.ApsGanttService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* APS 甘特图查询MVP
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps")
public class ApsGanttController extends BaseController {
private final ApsGanttService apsGanttService;
/**
* GET /aps/gantt
* 参数lineId/queryStart/queryEnd/planId/orderId
*/
@GetMapping("/gantt")
public R<List<ApsGanttItemVo>> gantt(@Validated ApsGanttQueryReq req) {
return R.ok(apsGanttService.selectGanttItems(req));
}
/**
* 工厂日历聚合接口(减轻前端计算压力)
*/
@GetMapping("/factory-calendar")
public R<ApsFactoryCalendarRespVo> factoryCalendar(@Validated ApsGanttQueryReq req) {
return R.ok(apsGanttService.queryFactoryCalendar(req));
}
}

View File

@@ -0,0 +1,93 @@
package com.klp.aps.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.aps.domain.bo.ApsLineCapabilityBo;
import com.klp.aps.domain.vo.ApsLineCapabilityVo;
import com.klp.aps.service.ApsLineCapabilityService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 产线能力Controller
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/line-capability")
public class ApsLineCapabilityController extends BaseController {
private final ApsLineCapabilityService apsLineCapabilityService;
/**
* 查询产线能力列表
*/
@GetMapping("/list")
public TableDataInfo<ApsLineCapabilityVo> list(ApsLineCapabilityBo bo, PageQuery pageQuery) {
return apsLineCapabilityService.queryPageList(bo, pageQuery);
}
/**
* 导出产线能力列表
*/
@Log(title = "产线能力", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ApsLineCapabilityBo bo, HttpServletResponse response) {
List<ApsLineCapabilityVo> list = apsLineCapabilityService.queryList(bo);
ExcelUtil.exportExcel(list, "产线能力", ApsLineCapabilityVo.class, response);
}
/**
* 获取产线能力详细信息
*/
@GetMapping("/{capabilityId}")
public R<ApsLineCapabilityVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long capabilityId) {
return R.ok(apsLineCapabilityService.queryById(capabilityId));
}
/**
* 新增产线能力
*/
@Log(title = "产线能力", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ApsLineCapabilityBo bo) {
return toAjax(apsLineCapabilityService.insertByBo(bo));
}
/**
* 修改产线能力
*/
@Log(title = "产线能力", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ApsLineCapabilityBo bo) {
return toAjax(apsLineCapabilityService.updateByBo(bo));
}
/**
* 删除产线能力
*/
@Log(title = "产线能力", businessType = BusinessType.DELETE)
@DeleteMapping("/{capabilityIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] capabilityIds) {
return toAjax(apsLineCapabilityService.deleteWithValidByIds(Arrays.asList(capabilityIds), true));
}
}

View File

@@ -0,0 +1,44 @@
package com.klp.aps.controller;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.aps.domain.dto.ApsLockReq;
import com.klp.aps.service.ApsLockService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* APS 锁定/解锁
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps")
public class ApsLockController extends BaseController {
private final ApsLockService apsLockService;
/**
* POST /aps/lock
*/
@PostMapping("/lock")
public R<Long> lock(@Validated @RequestBody ApsLockReq req) {
Long lockId = apsLockService.createLock(req, getUsername());
return R.ok(lockId);
}
/**
* POST /aps/lock/release/{lockId}
*/
@PostMapping("/lock/release/{lockId}")
public R<Void> release(@PathVariable Long lockId) {
apsLockService.releaseLock(lockId, getUsername());
return R.ok();
}
}

View File

@@ -0,0 +1,34 @@
package com.klp.aps.controller;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.aps.domain.dto.ApsRescheduleReq;
import com.klp.aps.service.ApsOperationService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* APS 工序级操作(重排等)
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/operation")
public class ApsOperationController extends BaseController {
private final ApsOperationService apsOperationService;
/**
* POST /aps/operation/reschedule
*/
@PostMapping("/reschedule")
public R<Void> reschedule(@Validated @RequestBody ApsRescheduleReq req) {
apsOperationService.reschedule(req, getUsername());
return R.ok();
}
}

View File

@@ -0,0 +1,48 @@
package com.klp.aps.controller;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.aps.domain.dto.ApsConvertFromCrmReq;
import com.klp.aps.domain.dto.ApsConvertFromCrmResp;
import com.klp.aps.domain.dto.ApsConvertFromProductReq;
import com.klp.aps.domain.dto.ApsConvertFromProductsReq;
import com.klp.aps.service.ApsPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/order")
public class ApsOrderController extends BaseController {
private final ApsPlanService apsPlanService;
@PostMapping("/convert-from-crm")
public R<ApsConvertFromCrmResp> convertFromCrm(@Validated @RequestBody ApsConvertFromCrmReq req) {
Long wmsOrderId = apsPlanService.convertFromCrmOrderWithItems(req.getCrmOrderId(), req.getCrmItemIds(), getUsername());
return R.ok(new ApsConvertFromCrmResp(wmsOrderId, null));
}
@PostMapping("/convert-from-product")
public R<ApsConvertFromCrmResp> convertFromProduct(@Validated @RequestBody ApsConvertFromProductReq req) {
Long wmsOrderId = apsPlanService.convertFromProduct(
req.getProductId(),
req.getQuantity(),
req.getProductName(),
req.getRemark(),
getUsername()
);
return R.ok(new ApsConvertFromCrmResp(wmsOrderId, null));
}
@PostMapping("/convert-from-products")
public R<ApsConvertFromCrmResp> convertFromProducts(@Validated @RequestBody ApsConvertFromProductsReq req) {
Long wmsOrderId = apsPlanService.convertFromProducts(req.getItems(), req.getRemark(), getUsername());
return R.ok(new ApsConvertFromCrmResp(wmsOrderId, null));
}
}

View File

@@ -0,0 +1,55 @@
package com.klp.aps.controller;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.aps.domain.dto.ApsAutoScheduleReq;
import com.klp.aps.domain.dto.ApsPlanCreateReq;
import com.klp.aps.service.ApsAutoScheduleService;
import com.klp.aps.service.ApsPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* APS 计划MVP
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/plan")
public class ApsPlanController extends BaseController {
private final ApsPlanService apsPlanService;
private final ApsAutoScheduleService apsAutoScheduleService;
/**
* POST /aps/plan/create
* 创建计划头与明细,返回 planId
*/
@PostMapping("/create")
public R<Long> create(@Validated @RequestBody ApsPlanCreateReq req) {
Long planId = apsPlanService.createPlan(req, getUsername());
return R.ok(planId);
}
/**
* POST /aps/plan/auto-schedule
* 自动排程生成 operation + change_log并更新 plan 状态
*/
@PostMapping("/auto-schedule")
public R<Void> autoSchedule(@Validated @RequestBody ApsAutoScheduleReq req) {
apsAutoScheduleService.autoSchedule(req, getUsername());
return R.ok();
}
/**
* POST /aps/plan/publish/{planId}
* 仅允许已排产(plan.status=1) 的计划发布,状态流转为 2已发布/生产中)
*/
@PostMapping("/publish/{planId}")
public R<Void> publish(@PathVariable Long planId) {
apsPlanService.publishPlan(planId, getUsername());
return R.ok();
}
}

View File

@@ -0,0 +1,55 @@
package com.klp.aps.controller;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.aps.domain.dto.ApsScheduleSheetQueryReq;
import com.klp.aps.domain.dto.ApsScheduleSheetSupplementSaveReq;
import com.klp.aps.domain.vo.ApsScheduleSheetResp;
import com.klp.aps.service.ApsScheduleSheetService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
/**
* 统一排产表(查询 + 导出)
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps")
public class ApsScheduleSheetController extends BaseController {
private final ApsScheduleSheetService apsScheduleSheetService;
/**
* GET /aps/schedule-sheet
*/
@GetMapping("/schedule-sheet")
public R<ApsScheduleSheetResp> query(@Validated ApsScheduleSheetQueryReq req) {
return R.ok(apsScheduleSheetService.query(req));
}
/**
* GET /aps/schedule-sheet/export
*/
@GetMapping("/schedule-sheet/export")
public void export(@Validated ApsScheduleSheetQueryReq req, HttpServletResponse response) {
apsScheduleSheetService.exportExcel(req, response);
}
/**
* POST /aps/schedule-sheet/supplement/save
*/
@PostMapping("/schedule-sheet/supplement/save")
public R<Void> saveSupplement(@Validated @RequestBody ApsScheduleSheetSupplementSaveReq req) {
apsScheduleSheetService.saveSupplement(req, getUsername());
return R.ok();
}
}

View File

@@ -0,0 +1,93 @@
package com.klp.aps.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.aps.domain.bo.ApsShiftTemplateBo;
import com.klp.aps.domain.vo.ApsShiftTemplateVo;
import com.klp.aps.service.ApsShiftTemplateService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 班次模板Controller
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/shift-template")
public class ApsShiftTemplateController extends BaseController {
private final ApsShiftTemplateService apsShiftTemplateService;
/**
* 查询班次模板列表
*/
@GetMapping("/list")
public TableDataInfo<ApsShiftTemplateVo> list(ApsShiftTemplateBo bo, PageQuery pageQuery) {
return apsShiftTemplateService.queryPageList(bo, pageQuery);
}
/**
* 导出班次模板列表
*/
@Log(title = "班次模板", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ApsShiftTemplateBo bo, HttpServletResponse response) {
List<ApsShiftTemplateVo> list = apsShiftTemplateService.queryList(bo);
ExcelUtil.exportExcel(list, "班次模板", ApsShiftTemplateVo.class, response);
}
/**
* 获取班次模板详细信息
*/
@GetMapping("/{shiftId}")
public R<ApsShiftTemplateVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long shiftId) {
return R.ok(apsShiftTemplateService.queryById(shiftId));
}
/**
* 新增班次模板
*/
@Log(title = "班次模板", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ApsShiftTemplateBo bo) {
return toAjax(apsShiftTemplateService.insertByBo(bo));
}
/**
* 修改班次模板
*/
@Log(title = "班次模板", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ApsShiftTemplateBo bo) {
return toAjax(apsShiftTemplateService.updateByBo(bo));
}
/**
* 删除班次模板
*/
@Log(title = "班次模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{shiftIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] shiftIds) {
return toAjax(apsShiftTemplateService.deleteWithValidByIds(Arrays.asList(shiftIds), true));
}
}