diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java index 0db895dd..76146ca0 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java @@ -44,6 +44,7 @@ public enum CodeEnum { PROJECT_ORDER("业务订单", 3, "yyyyMM"), PROJECT_DELIVERY_ORDER("发货单", "HL", 3, "yyyyMM"), PROJECT_PLAN("生产计划", "PP",3, "yyyyMM"), + MATERIAL_PLAN("物料需求计划", "PR",4, "yyyyMMdd"), ; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanPageReqVO.java index aeda0d14..6ab6858a 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanPageReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanPageReqVO.java @@ -7,6 +7,7 @@ import com.chanko.yunxi.mes.framework.common.pojo.PageParam; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; +import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @Schema(description = "管理后台 - 物料需求计划分页 Request VO") @@ -21,6 +22,12 @@ public class MaterialPlanPageReqVO extends PageParam { @Schema(description = "物料计划单号") private String projectMaterialPlanNo; + @Schema(description = "生产计划单号") + private String planNo; + + @Schema(description = "项目名称") + private String projectName; + @Schema(description = "订单id") private Long projectId; @@ -48,7 +55,6 @@ public class MaterialPlanPageReqVO extends PageParam { private String description; @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; + private String createTime; } \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanRespVO.java index fa649020..d6353fa9 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanRespVO.java @@ -23,6 +23,14 @@ public class MaterialPlanRespVO { @ExcelProperty("物料计划单号") private String projectMaterialPlanNo; + @Schema(description = "生产计划单号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("生产计划单号") + private String planNo; + + @Schema(description = "项目单号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("项目单号") + private String projectName; + @Schema(description = "订单id") @ExcelProperty("订单id") private Long projectId; @@ -56,6 +64,10 @@ public class MaterialPlanRespVO { @ExcelProperty("备注") private String description; + @Schema(description = "创建人") + @ExcelProperty("创建人") + private Long creator; + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") private LocalDateTime createTime; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanSaveReqVO.java index 339421f1..3cea6416 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanSaveReqVO.java @@ -1,46 +1,45 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; - -@Schema(description = "管理后台 - 物料需求计划新增/修改 Request VO") -@Data -public class MaterialPlanSaveReqVO { - - @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) - private Long id; - - @Schema(description = "物料计划单号", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "物料计划单号不能为空") - private String projectMaterialPlanNo; - - @Schema(description = "订单id") - private Long projectId; - - @Schema(description = "生产计划id") - private Long projectPlanId; - - @Schema(description = "送审人") - private Long submitUserId; - - @Schema(description = "送审时间") - private LocalDateTime submitTime; - - @Schema(description = "审核人") - private Long auditor; - - @Schema(description = "审核时间") - private LocalDateTime auditTime; - - @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") - private Integer status; - - @Schema(description = "备注") - private String description; - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 物料需求计划新增/修改 Request VO") +@Data +public class MaterialPlanSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "物料计划单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String projectMaterialPlanNo; + + @Schema(description = "订单id") + private Long projectId; + + @Schema(description = "生产计划id") + private Long projectPlanId; + + @Schema(description = "送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + private LocalDateTime submitTime; + + @Schema(description = "审核人") + private Long auditor; + + @Schema(description = "审核时间") + private LocalDateTime auditTime; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + private Integer status; + + @Schema(description = "备注") + private String description; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/PlanController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/PlanController.java index d54606ce..ffceee0e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/PlanController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/PlanController.java @@ -1,95 +1,103 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.plan; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; -import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; - -import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; - -import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; -import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; - -import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; -import com.chanko.yunxi.mes.module.heli.service.plan.PlanService; - -@Tag(name = "管理后台 - 生产计划") -@RestController -@RequestMapping("/heli/plan") -@Validated -public class PlanController { - - @Resource - private PlanService planService; - - @PostMapping("/create") - @Operation(summary = "创建生产计划") - @PreAuthorize("@ss.hasPermission('heli:plan:create')") - public CommonResult createPlan(@Valid @RequestBody PlanSaveReqVO createReqVO) { - return success(planService.createPlan(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新生产计划") - @PreAuthorize("@ss.hasPermission('heli:plan:update')") - public CommonResult updatePlan(@Valid @RequestBody PlanSaveReqVO updateReqVO) { - planService.updatePlan(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除生产计划") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:plan:delete')") - public CommonResult deletePlan(@RequestParam("id") Long id) { - planService.deletePlan(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得生产计划") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:plan:query')") - public CommonResult getPlan(@RequestParam("id") Long id) { - PlanDO plan = planService.getPlan(id); - return success(BeanUtils.toBean(plan, PlanRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得生产计划分页") - @PreAuthorize("@ss.hasPermission('heli:plan:query')") - public CommonResult> getPlanPage(@Valid PlanPageReqVO pageReqVO) { - PageResult pageResult = planService.getPlanPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, PlanRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出生产计划 Excel") - @PreAuthorize("@ss.hasPermission('heli:plan:export')") - @OperateLog(type = EXPORT) - public void exportPlanExcel(@Valid PlanPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = planService.getPlanPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "生产计划.xls", "数据", PlanRespVO.class, - BeanUtils.toBean(list, PlanRespVO.class)); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.plan; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +import com.chanko.yunxi.mes.module.heli.service.plan.PlanService; + +@Tag(name = "管理后台 - 生产计划") +@RestController +@RequestMapping("/heli/plan") +@Validated +public class PlanController { + + @Resource + private PlanService planService; + + @PostMapping("/create") + @Operation(summary = "创建生产计划") + @PreAuthorize("@ss.hasPermission('heli:plan:create')") + public CommonResult createPlan(@Valid @RequestBody PlanSaveReqVO createReqVO) { + return success(planService.createPlan(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新生产计划") + @PreAuthorize("@ss.hasPermission('heli:plan:update')") + public CommonResult updatePlan(@Valid @RequestBody PlanSaveReqVO updateReqVO) { + planService.updatePlan(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除生产计划") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:plan:delete')") + public CommonResult deletePlan(@RequestParam("id") Long id) { + planService.deletePlan(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得生产计划") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:plan:query')") + public CommonResult getPlan(@RequestParam("id") Long id) { + PlanDO plan = planService.getPlan(id); + return success(BeanUtils.toBean(plan, PlanRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得生产计划分页") + @PreAuthorize("@ss.hasPermission('heli:plan:query')") + public CommonResult> getPlanPage(@Valid PlanPageReqVO pageReqVO) { + PageResult pageResult = planService.getPlanPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PlanRespVO.class)); + } + + @GetMapping("/page-by-status") + @Operation(summary = "获得生产计划分页") + @PreAuthorize("@ss.hasPermission('heli:plan:query')") + public CommonResult> getPlanPageByStatus(@Valid PlanPageReqVO pageReqVO) { + PageResult pageResult = planService.getPlanPageByStatus(pageReqVO); + return success(BeanUtils.toBean(pageResult, PlanRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出生产计划 Excel") + @PreAuthorize("@ss.hasPermission('heli:plan:export')") + @OperateLog(type = EXPORT) + public void exportPlanExcel(@Valid PlanPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = planService.getPlanPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "生产计划.xls", "数据", PlanRespVO.class, + BeanUtils.toBean(list, PlanRespVO.class)); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/materialplan/MaterialPlanDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/materialplan/MaterialPlanDO.java index c0a198cd..30bef219 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/materialplan/MaterialPlanDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/materialplan/MaterialPlanDO.java @@ -33,6 +33,7 @@ public class MaterialPlanDO extends BaseDO { * 物料计划单号 */ private String projectMaterialPlanNo; + /** * 订单id */ @@ -68,4 +69,19 @@ public class MaterialPlanDO extends BaseDO { */ private String description; + /** + * 创建人 + */ + private String creator; + /** + * 生产计划单号 + */ + @TableField(exist = false) + private String planNo; + /** + * 项目名称 + */ + @TableField(exist = false) + private String projectName; + } \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagelogAll/StorageLogAllDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagelogAll/StorageLogAllDO.java index d04d8dfa..26cc4a3e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagelogAll/StorageLogAllDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagelogAll/StorageLogAllDO.java @@ -53,6 +53,7 @@ public class StorageLogAllDO extends BaseDO { private String matType; private String whName; + private Long whId; private String rgName; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/materialplan/MaterialPlanMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/materialplan/MaterialPlanMapper.java index fecc74e9..f0b75169 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/materialplan/MaterialPlanMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/materialplan/MaterialPlanMapper.java @@ -5,9 +5,16 @@ import java.util.*; import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO; +import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.apache.ibatis.annotations.Mapper; import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*; +import org.springframework.util.StringUtils; /** * 物料需求计划 Mapper @@ -18,19 +25,36 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*; public interface MaterialPlanMapper extends BaseMapperX { default PageResult selectPage(MaterialPlanPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(MaterialPlanDO::getId, reqVO.getId()) - .likeIfPresent(MaterialPlanDO::getProjectMaterialPlanNo, reqVO.getProjectMaterialPlanNo()) - .eqIfPresent(MaterialPlanDO::getProjectId, reqVO.getProjectId()) - .eqIfPresent(MaterialPlanDO::getProjectPlanId, reqVO.getProjectPlanId()) - .eqIfPresent(MaterialPlanDO::getSubmitUserId, reqVO.getSubmitUserId()) - .betweenIfPresent(MaterialPlanDO::getSubmitTime, reqVO.getSubmitTime()) - .eqIfPresent(MaterialPlanDO::getAuditor, reqVO.getAuditor()) - .betweenIfPresent(MaterialPlanDO::getAuditTime, reqVO.getAuditTime()) - .eqIfPresent(MaterialPlanDO::getStatus, reqVO.getStatus()) - .eqIfPresent(MaterialPlanDO::getDescription, reqVO.getDescription()) - .betweenIfPresent(MaterialPlanDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(MaterialPlanDO::getId)); + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(MaterialPlanDO.class) + .select("p.project_name as projectName","pl.plan_no as planNo") + .leftJoin(PlanDO.class, "pl", PlanDO::getId, MaterialPlanDO::getProjectPlanId) + .leftJoin(ProjectOrderDO.class, "p", ProjectOrderDO::getId, MaterialPlanDO::getProjectId) + .disableSubLogicDel() + .orderByDesc(MaterialPlanDO::getCreateTime); + query.like(!StringUtils.isEmpty(reqVO.getProjectMaterialPlanNo()), MaterialPlanDO::getProjectMaterialPlanNo, reqVO.getProjectMaterialPlanNo()) + .like(!StringUtils.isEmpty(reqVO.getProjectName()), "p.project_name", reqVO.getProjectName()) + .like(!StringUtils.isEmpty(reqVO.getPlanNo()), "pl.plan_no", reqVO.getPlanNo()) + .apply(reqVO.getCreateTime() != null, "DATE_FORMAT(t.create_time,'%Y-%m-%d') = {0}", reqVO.getCreateTime()) + .eq(reqVO.getStatus() != null, MaterialPlanDO::getStatus, reqVO.getStatus()); + + return selectPage(reqVO, query); } +// default PageResult selectPage(MaterialPlanPageReqVO reqVO) { +// return selectPage(reqVO, new LambdaQueryWrapperX() +// .eqIfPresent(MaterialPlanDO::getId, reqVO.getId()) +// .likeIfPresent(MaterialPlanDO::getProjectMaterialPlanNo, reqVO.getProjectMaterialPlanNo()) +// .eqIfPresent(MaterialPlanDO::getProjectId, reqVO.getProjectId()) +// .eqIfPresent(MaterialPlanDO::getProjectPlanId, reqVO.getProjectPlanId()) +// .eqIfPresent(MaterialPlanDO::getSubmitUserId, reqVO.getSubmitUserId()) +// .betweenIfPresent(MaterialPlanDO::getSubmitTime, reqVO.getSubmitTime()) +// .eqIfPresent(MaterialPlanDO::getAuditor, reqVO.getAuditor()) +// .betweenIfPresent(MaterialPlanDO::getAuditTime, reqVO.getAuditTime()) +// .eqIfPresent(MaterialPlanDO::getStatus, reqVO.getStatus()) +// .eqIfPresent(MaterialPlanDO::getDescription, reqVO.getDescription()) +// .betweenIfPresent(MaterialPlanDO::getCreateTime, reqVO.getCreateTime()) +// .orderByDesc(MaterialPlanDO::getId)); +// } } \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plan/PlanMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plan/PlanMapper.java index 83ba8864..268f2d6f 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plan/PlanMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plan/PlanMapper.java @@ -8,6 +8,7 @@ import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO; +import com.chanko.yunxi.mes.module.heli.enums.ProjectPlanStatusEnum; import com.chanko.yunxi.mes.module.system.dal.dataobject.dept.DeptDO; import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO; import com.github.yulichang.wrapper.MPJLambdaWrapper; @@ -46,6 +47,30 @@ public interface PlanMapper extends BaseMapperX { return selectPage(reqVO, query); } + default PageResult selectPageByStatus(PlanPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(PlanDO.class) + .select("u.nickname as businessManName", "e.name as customerName","p.code as projectCode","p.project_name as projectName","p.project_start_time as projectStartTime","p.project_end_time as projectEndTime","p.business_line as businessLine","p.property","p.is_urgency as isUrgency","p.has_alter as hasAlter") + .leftJoin(ProjectOrderDO.class, "p", ProjectOrderDO::getId, PlanDO::getProjectId) + .leftJoin(AdminUserDO.class, "u", AdminUserDO::getId, ProjectOrderDO::getBusinessMan) + .leftJoin(CustomerDO.class, "e", CustomerDO::getId, ProjectOrderDO::getCustomerId) + .disableSubLogicDel() + .orderByDesc(PlanDO::getPlanNo); + query.like(!StringUtils.isEmpty(reqVO.getPlanNo()), PlanDO::getPlanNo, reqVO.getPlanNo()) + .like(!StringUtils.isEmpty(reqVO.getProjectCode()), "p.code", reqVO.getProjectCode()) + .like(!StringUtils.isEmpty(reqVO.getCustomerName()), "e.name", reqVO.getCustomerName()) + .like(!StringUtils.isEmpty(reqVO.getProjectName()), ProjectOrderDO::getProjectName, reqVO.getProjectName()) + .like(!StringUtils.isEmpty(reqVO.getBusinessManName()), "u.nickname", reqVO.getBusinessManName()) + .like(!StringUtils.isEmpty(reqVO.getProjectOwner()), PlanDO::getProjectOwner, reqVO.getProjectOwner()) + .eq(reqVO.getBusinessLine() != null, ProjectOrderDO::getBusinessLine, reqVO.getBusinessLine()) + .eq(reqVO.getProperty() != null, ProjectOrderDO::getProperty, reqVO.getProperty()) + .ne(true, PlanDO::getStatus, ProjectPlanStatusEnum.COMPLETE.getCode()) + .ne(true,PlanDO::getStatus,ProjectPlanStatusEnum.TERMINATE.getCode()); + + return selectPage(reqVO, query); + } + // default PageResult selectPage(PlanPageReqVO reqVO) { // return selectPage(reqVO, new LambdaQueryWrapperX() // .eqIfPresent(PlanDO::getId, reqVO.getId()) diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagelog/StorageLogAllMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagelog/StorageLogAllMapper.java index 1fcd61a0..ac9a9609 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagelog/StorageLogAllMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagelog/StorageLogAllMapper.java @@ -30,6 +30,7 @@ public interface StorageLogAllMapper extends BaseMapperX { query.like(!StringUtils.isEmpty(reqVO.getMatType()),StorageLogAllDO::getMatType, reqVO.getMatType()) .eq(reqVO.getStockType()!= null,StorageLogAllDO::getStockType, reqVO.getStockType()) + .eq(reqVO.getWhId()!= null,StorageLogAllDO::getWhId, reqVO.getWhId()) .like(!StringUtils.isEmpty(reqVO.getMatName()), StorageLogAllDO::getMatName, reqVO.getMatName()) .like(!StringUtils.isEmpty(reqVO.getMatCode()), StorageLogAllDO::getMatCode, reqVO.getMatCode()) .like(!StringUtils.isEmpty(reqVO.getStockNo()), StorageLogAllDO::getStockNo, reqVO.getStockNo()) diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanServiceImpl.java index 4478920d..2fa2eaeb 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanServiceImpl.java @@ -1,74 +1,93 @@ -package com.chanko.yunxi.mes.module.heli.service.materialplan; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; - -import com.chanko.yunxi.mes.module.heli.dal.mysql.materialplan.MaterialPlanMapper; - -import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; - -/** - * 物料需求计划 Service 实现类 - * - * @author 管理员 - */ -@Service -@Validated -public class MaterialPlanServiceImpl implements MaterialPlanService { - - @Resource - private MaterialPlanMapper materialPlanMapper; - - @Override - public Long createMaterialPlan(MaterialPlanSaveReqVO createReqVO) { - // 插入 - MaterialPlanDO materialPlan = BeanUtils.toBean(createReqVO, MaterialPlanDO.class); - materialPlanMapper.insert(materialPlan); - // 返回 - return materialPlan.getId(); - } - - @Override - public void updateMaterialPlan(MaterialPlanSaveReqVO updateReqVO) { - // 校验存在 - validateMaterialPlanExists(updateReqVO.getId()); - // 更新 - MaterialPlanDO updateObj = BeanUtils.toBean(updateReqVO, MaterialPlanDO.class); - materialPlanMapper.updateById(updateObj); - } - - @Override - public void deleteMaterialPlan(Long id) { - // 校验存在 - validateMaterialPlanExists(id); - // 删除 - materialPlanMapper.deleteById(id); - } - - private void validateMaterialPlanExists(Long id) { - if (materialPlanMapper.selectById(id) == null) { - throw exception(MATERIAL_PLAN_NOT_EXISTS); - } - } - - @Override - public MaterialPlanDO getMaterialPlan(Long id) { - return materialPlanMapper.selectById(id); - } - - @Override - public PageResult getMaterialPlanPage(MaterialPlanPageReqVO pageReqVO) { - return materialPlanMapper.selectPage(pageReqVO); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.materialplan; + +import com.chanko.yunxi.mes.module.heli.dal.dataobject.serialnumber.SerialNumberDO; +import com.chanko.yunxi.mes.module.heli.service.serialnumber.SerialNumberService; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.materialplan.MaterialPlanMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.MATERIAL_PLAN; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.PROJECT_PLAN; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 物料需求计划 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class MaterialPlanServiceImpl implements MaterialPlanService { + + @Resource + private MaterialPlanMapper materialPlanMapper; + + @Resource + private SerialNumberService serialNumberService; + + @Override + public Long createMaterialPlan(MaterialPlanSaveReqVO createReqVO) { + // 插入 + MaterialPlanDO materialPlan = BeanUtils.toBean(createReqVO, MaterialPlanDO.class); + + // 月度流水号 + SerialNumberDO serialNumberDO = new SerialNumberDO(); + serialNumberDO = serialNumberService.getSerialNumber(MATERIAL_PLAN.name(), new SimpleDateFormat("yyyyMMdd").format(new Date())); + serialNumberDO.setSerialNumber(serialNumberDO.getSerialNumber()+1); + + materialPlan.setProjectMaterialPlanNo(MATERIAL_PLAN.getCode(serialNumberDO.getSerialNumber().toString())); + + materialPlanMapper.insert(materialPlan); + + // 回写序列记录 + serialNumberService.updateSerialNumber(serialNumberDO); + // 返回 + return materialPlan.getId(); + } + + @Override + public void updateMaterialPlan(MaterialPlanSaveReqVO updateReqVO) { + // 校验存在 + validateMaterialPlanExists(updateReqVO.getId()); + // 更新 + MaterialPlanDO updateObj = BeanUtils.toBean(updateReqVO, MaterialPlanDO.class); + materialPlanMapper.updateById(updateObj); + } + + @Override + public void deleteMaterialPlan(Long id) { + // 校验存在 + validateMaterialPlanExists(id); + // 删除 + materialPlanMapper.deleteById(id); + } + + private void validateMaterialPlanExists(Long id) { + if (materialPlanMapper.selectById(id) == null) { + throw exception(MATERIAL_PLAN_NOT_EXISTS); + } + } + + @Override + public MaterialPlanDO getMaterialPlan(Long id) { + return materialPlanMapper.selectById(id); + } + + @Override + public PageResult getMaterialPlanPage(MaterialPlanPageReqVO pageReqVO) { + return materialPlanMapper.selectPage(pageReqVO); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanService.java index e611efd1..83265a0e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanService.java @@ -52,6 +52,8 @@ public interface PlanService { */ PageResult getPlanPage(PlanPageReqVO pageReqVO); + PageResult getPlanPageByStatus(PlanPageReqVO pageReqVO); + void generatePlanByProjectId(Long projectId); void updatePlanStatusToTerminateByProjectId(Long projectId); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java index b1b402fb..5f293570 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java @@ -109,6 +109,11 @@ public class PlanServiceImpl implements PlanService { return planMapper.selectPage(pageReqVO); } + @Override + public PageResult getPlanPageByStatus(PlanPageReqVO pageReqVO) { + return planMapper.selectPageByStatus(pageReqVO); + } + @Override public void generatePlanByProjectId(Long projectId){ // 查询最近归档历史并对比变化字段 diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/plan/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/plan/index.ts index 3b30d14b..e2ada117 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/plan/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/plan/index.ts @@ -20,6 +20,11 @@ export interface PlanVO { status: number } +// 查询生产计划分页 +export const getPlanPageByStatus = async (params) => { + return await request.get({ url: `/heli/plan/page-by-status`, params }) +} + // 查询生产计划分页 export const getPlanPage = async (params) => { return await request.get({ url: `/heli/plan/page`, params }) diff --git a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts index 7872ca21..ba43d316 100644 --- a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts +++ b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts @@ -242,4 +242,5 @@ export enum DICT_TYPE { HELI_DELIVER_MATERIAL_TYPE = 'heli_deliver_material_type', // 发货物料类型 HELI_PROJECT_PLAN_STATUS = 'heli_project_plan_status',//生产计划状态 HELI_CRAFT = 'heli_craft',//工艺流程 + HELI_PROJECT_MATERIAL_PLAN_STATUS = 'heli_project_material_plan_status',//物料需求计划状态 } diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/MaterialPlanForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/MaterialPlanForm.vue deleted file mode 100644 index a41095ea..00000000 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/MaterialPlanForm.vue +++ /dev/null @@ -1,148 +0,0 @@ - - \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/add.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/add.vue new file mode 100644 index 00000000..b6a6e42e --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/add.vue @@ -0,0 +1,157 @@ + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/index.vue index 06214ec6..1736296a 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/materialplan/index.vue @@ -1,7 +1,7 @@