refactor(出库计划): 自动生成计划编码

This commit is contained in:
Kelvin 2024-12-09 14:55:23 +08:00
parent 6e5da0821b
commit 1626935c8d

View File

@ -8,6 +8,7 @@ import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.AP0AE;
import com.ktg.mes.md.domain.WmsOutPlan;
import com.ktg.mes.md.domain.WmsOutPlanDetailEntity;
@ -83,8 +84,12 @@ public class WmsOutPlanController extends BaseController {
@Log(title = "出库计划管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsOutPlan wmsOutPlan) {
if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// if (UserConstants.NOT_UNIQUE.equals(wmsOutPlanService.checkPlanCodeUnique(wmsOutPlan))) {
// return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// }
// 出库计划编码自动生成
if (wmsOutPlan.getPlanCode().isEmpty() || wmsOutPlan.getPlanCode() == null) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
}
wmsOutPlan.setCreateBy(getUsername());
return toAjax(wmsOutPlanService.insertWmsOutPlan(wmsOutPlan));