diff --git a/.gitignore b/.gitignore index 846a01b8..f42b8c74 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ node_modules/ hs_err_pid* replay_pid* target +/.flattened-pom.xml diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java index 44b32143..03dd7a41 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java @@ -164,5 +164,6 @@ public interface ErrorCodeConstants { ErrorCode TRACK_NOT_EXISTS = new ErrorCode(1_013_002, "生产进度跟踪不存在"); ErrorCode MAT_REQ_NOT_EXISTS = new ErrorCode(1_013_003, "领料单不存在"); ErrorCode MAT_REQ_DETAIL_NOT_EXISTS = new ErrorCode(1_013_004, "领料单明细不存在"); + ErrorCode TASK_IN_REPORT_NOT_EXISTS = new ErrorCode(1_013_005 , "下料报工不存在"); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/TaskInReportController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/TaskInReportController.java new file mode 100644 index 00000000..de6a3955 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/TaskInReportController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport; + +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.taskinreport.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskinreport.TaskInReportDO; +import com.chanko.yunxi.mes.module.heli.service.taskinreport.TaskInReportService; + +@Tag(name = "管理后台 - 下料报工") +@RestController +@RequestMapping("/heli/task-in-report") +@Validated +public class TaskInReportController { + + @Resource + private TaskInReportService taskInReportService; + + @PostMapping("/create") + @Operation(summary = "创建下料报工") + @PreAuthorize("@ss.hasPermission('heli:task-in-report:create')") + public CommonResult createTaskInReport(@Valid @RequestBody TaskInReportSaveReqVO createReqVO) { + return success(taskInReportService.createTaskInReport(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新下料报工") + @PreAuthorize("@ss.hasPermission('heli:task-in-report:update')") + public CommonResult updateTaskInReport(@Valid @RequestBody TaskInReportSaveReqVO updateReqVO) { + taskInReportService.updateTaskInReport(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除下料报工") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:task-in-report:delete')") + public CommonResult deleteTaskInReport(@RequestParam("id") Long id) { + taskInReportService.deleteTaskInReport(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得下料报工") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:task-in-report:query')") + public CommonResult getTaskInReport(@RequestParam("id") Long id) { + TaskInReportDO taskInReport = taskInReportService.getTaskInReport(id); + return success(BeanUtils.toBean(taskInReport, TaskInReportRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得下料报工分页") + @PreAuthorize("@ss.hasPermission('heli:task-in-report:query')") + public CommonResult> getTaskInReportPage(@Valid TaskInReportPageReqVO pageReqVO) { + PageResult pageResult = taskInReportService.getTaskInReportPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, TaskInReportRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出下料报工 Excel") + @PreAuthorize("@ss.hasPermission('heli:task-in-report:export')") + @OperateLog(type = EXPORT) + public void exportTaskInReportExcel(@Valid TaskInReportPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = taskInReportService.getTaskInReportPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "下料报工.xls", "数据", TaskInReportRespVO.class, + BeanUtils.toBean(list, TaskInReportRespVO.class)); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/vo/TaskInReportPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/vo/TaskInReportPageReqVO.java new file mode 100644 index 00000000..e3ae748f --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/vo/TaskInReportPageReqVO.java @@ -0,0 +1,58 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo; + +import lombok.*; + +import java.util.*; + +import io.swagger.v3.oas.annotations.media.Schema; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +import java.math.BigDecimal; + +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_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 下料报工分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class TaskInReportPageReqVO extends PageParam { + + @Schema(description = "报工人") + private String ownerName; + + @Schema(description = "项目编号") + private String projectCode; + + @Schema(description = "项目名称") + private String projectName; + + @Schema(description = "子项目名称") + private String projectSubName; + + @Schema(description = "零件名称") + private String materialName; + + @Schema(description = "报工日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] reportTime; + + @Schema(description = "派工单任务明细id", example = "23399") + private Long dispatchDetailId; + + @Schema(description = "负责人") + private Long owner; + + @Schema(description = "开始时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] startTime; + + @Schema(description = "结束时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] endTime; + + +} \ 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/taskinreport/vo/TaskInReportRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/vo/TaskInReportRespVO.java new file mode 100644 index 00000000..ca99f60c --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/vo/TaskInReportRespVO.java @@ -0,0 +1,130 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 下料报工 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TaskInReportRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "12397") + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "派工单任务明细id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6501") + @ExcelProperty("派工单任务明细id") + private Long dispatchDetailId; + + @Schema(description = "负责人", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("负责人") + private Long owner; + + @Schema(description = "数量") + @ExcelProperty("数量") + private Integer amount; + + @Schema(description = "报工日期") + @ExcelProperty("报工日期") + private LocalDateTime reportTime; + + @Schema(description = "长度(半径)") + @ExcelProperty("长度(半径)") + private BigDecimal length; + + @Schema(description = "是否已报工 0 默认否 1 是", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否已报工 0 默认否 1 是") + private Boolean hasReport; + + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("状态,1表示正常,2表示禁用") + private Boolean status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "报工类型(1、工时 2、价格)", example = "2") + @ExcelProperty("报工类型(1、工时 2、价格)") + private String workType; + + @Schema(description = "原因说明", example = "随便") + @ExcelProperty("原因说明") + private String remark; + + @Schema(description = "宽度") + @ExcelProperty("宽度") + private BigDecimal widht; + + @Schema(description = "高度") + @ExcelProperty("高度") + private BigDecimal hight; + + @Schema(description = "密度") + @ExcelProperty("密度") + private BigDecimal density; + + @Schema(description = "重量") + @ExcelProperty("重量") + private BigDecimal weight; + + @Schema(description = "单价", example = "15935") + @ExcelProperty("单价") + private BigDecimal price; + + @Schema(description = "总价", example = "11053") + @ExcelProperty("总价") + private BigDecimal reportPrice; + + @Schema(description = "下料类型(1、块料 2、棒料 3、方料)", example = "2") + @ExcelProperty("下料类型(1、块料 2、棒料 3、方料)") + private String matType; + + @Schema(description = "计算工时id", example = "1190") + @ExcelProperty("计算工时id") + private Long formalId; + + @Schema(description = "计算公式") + @ExcelProperty("计算公式") + private String calFormal; + + @Schema(description = "报工人", example = "莉莉") + @ExcelProperty("报工人") + private String ownerName; + @Schema(description = "更新人", example = "张丹") + @ExcelProperty("更新人") + private String updaterName; + @Schema(description = "报工状态", example = "1、未报工 2、已报工 3、报工完成 ") + @ExcelProperty("报工状态") + private String reportProcess; + + @Schema(description = "物料名称", example = "块料") + @ExcelProperty("物料名称") + private String materialName; + + @Schema(description = "项目编号", example = "ZD") + @ExcelProperty("项目编号") + private String projectCode; + + @Schema(description = "项目名称") + @ExcelProperty("项目名称") + private String projectName; + @Schema(description = "子项目名称") + @ExcelProperty("子项目名称") + private String projectSubName; + @Schema(description = "更新时间") + @ExcelProperty("更新时间") + private LocalDateTime updateTime; + + @Schema(description = "工序名称") + private String procedureName; + + +} \ 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/taskinreport/vo/TaskInReportSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/vo/TaskInReportSaveReqVO.java new file mode 100644 index 00000000..70ef674a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskinreport/vo/TaskInReportSaveReqVO.java @@ -0,0 +1,77 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 下料报工新增/修改 Request VO") +@Data +public class TaskInReportSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "12397") + private Long id; + + @Schema(description = "派工单任务明细id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6501") + @NotNull(message = "派工单任务明细id不能为空") + private Long dispatchDetailId; + + @Schema(description = "负责人", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "负责人不能为空") + private Long owner; + + @Schema(description = "数量") + private Integer amount; + + @Schema(description = "报工日期") + private LocalDateTime reportTime; + + @Schema(description = "长度(半径)") + private BigDecimal length; + + @Schema(description = "是否已报工 0 默认否 1 是", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否已报工 0 默认否 1 是不能为空") + private Boolean hasReport; + + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态,1表示正常,2表示禁用不能为空") + private Boolean status; + + @Schema(description = "报工类型(1、工时 2、价格)", example = "2") + private String workType; + + @Schema(description = "原因说明", example = "随便") + private String remark; + + @Schema(description = "宽度") + private BigDecimal widht; + + @Schema(description = "高度") + private BigDecimal hight; + + @Schema(description = "密度") + private BigDecimal density; + + @Schema(description = "重量") + private BigDecimal weight; + + @Schema(description = "单价", example = "15935") + private BigDecimal price; + + @Schema(description = "总价", example = "11053") + private BigDecimal reportPrice; + + @Schema(description = "下料类型(1、块料 2、棒料 3、方料)", example = "2") + private String matType; + + @Schema(description = "计算工时id", example = "1190") + private Long formalId; + + @Schema(description = "计算公式") + private String calFormal; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/taskinreport/TaskInReportDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/taskinreport/TaskInReportDO.java new file mode 100644 index 00000000..da55f705 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/taskinreport/TaskInReportDO.java @@ -0,0 +1,139 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.taskinreport; + +import lombok.*; + +import java.util.*; +import java.time.LocalDateTime; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 下料报工 DO + * + * @author 管理员 + */ +@TableName("pro_task_in_report") +@KeySequence("pro_task_in_report_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaskInReportDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 派工单任务明细id + */ + private Long dispatchDetailId; + /** + * 负责人 + */ + private Long owner; + /** + * 数量 + */ + private Integer amount; + /** + * 报工日期 + */ + private LocalDateTime reportTime; + /** + * 长度(半径) + */ + private BigDecimal length; + /** + * 是否已报工 0 默认否 1 是 + */ + private Boolean hasReport; + /** + * 状态,1表示正常,2表示禁用 + */ + private Boolean status; + /** + * 报工类型(1、工时 2、价格) + */ + private String workType; + /** + * 原因说明 + */ + private String remark; + /** + * 宽度 + */ + private BigDecimal widht; + /** + * 高度 + */ + private BigDecimal hight; + /** + * 密度 + */ + private BigDecimal density; + /** + * 重量 + */ + private BigDecimal weight; + /** + * 单价 + */ + private BigDecimal price; + /** + * 总价 + */ + private BigDecimal reportPrice; + /** + * 下料类型(1、块料 2、棒料 3、方料) + */ + private String matType; + /** + * 计算工时id + */ + private Long formalId; + /** + * 计算公式 + */ + private String calFormal; + + + @TableField(exist = false) + private String ownerName; + + @TableField(exist = false) + private String updaterName; + + @TableField(exist = false) + private String reportProcess; + + @TableField(exist = false) + private String materialName; + + @TableField(exist = false) + private String projectCode; + + @TableField(exist = false) + private String projectName; + + @TableField(exist = false) + private String projectSubName; + + @TableField(exist = false) + private String procedureName; + + +} \ 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/taskinreport/TaskInReportMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskinreport/TaskInReportMapper.java new file mode 100644 index 00000000..ded29f18 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskinreport/TaskInReportMapper.java @@ -0,0 +1,69 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.taskinreport; + +import java.time.LocalDateTime; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.procedure.ProcedureDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskinreport.TaskInReportDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskreport.TaskReportDO; +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.taskinreport.vo.*; +import org.springframework.util.StringUtils; + +/** + * 下料报工 Mapper + * + * @author 管理员 + */ +@Mapper +public interface TaskInReportMapper extends BaseMapperX { + + + default PageResult selectPage(TaskInReportPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(TaskInReportDO.class) + .select("x.in_report_process as reportProcess") + .select("d.code as projectCode", "d.project_name as projectName", "c.name as projectSubName") + .select("z.code as dispatchCode") + .select("f.material_name as materialName", "f.spec", "f.unit") + .select("y.name as procedureName") + .select("u1.nickname as ownerName", "u2.nickname as updaterName") + .leftJoin(TaskDispatchDetailDO.class, "x", TaskDispatchDetailDO::getId, TaskInReportDO::getDispatchDetailId) + .leftJoin(ProcedureDO.class, "y", ProcedureDO::getId, TaskDispatchDetailDO::getProcedureId) + .leftJoin(TaskDispatchDO.class, "z", TaskDispatchDO::getId, TaskDispatchDetailDO::getDispatchId) + .leftJoin(ProjectOrderSubDO.class, "c", ProjectOrderSubDO::getId, TaskDispatchDO::getProjectSubId) + .leftJoin(ProjectOrderDO.class, "d", ProjectOrderDO::getId, ProjectOrderSubDO::getProjectOrderId) + .leftJoin(ProcessBomDetailDO.class, "f", ProcessBomDetailDO::getId, TaskDispatchDO::getBomDetailId) + .leftJoin(AdminUserDO.class, "u1", AdminUserDO::getId, TaskInReportDO::getOwner) + .leftJoin(AdminUserDO.class, "u2", AdminUserDO::getId, TaskInReportDO::getUpdater) + .orderByDesc(TaskInReportDO::getId) + .disableSubLogicDel(); + + query.eq(reqVO.getOwner() != null, TaskInReportDO::getOwner, reqVO.getOwner()) + .like(!StringUtils.isEmpty(reqVO.getProjectCode()), ProjectOrderDO::getCode, reqVO.getProjectCode()) + .like(!StringUtils.isEmpty(reqVO.getProjectName()), ProjectOrderDO::getProjectName, reqVO.getProjectName()) + .like(!StringUtils.isEmpty(reqVO.getProjectSubName()), ProjectOrderSubDO::getName, reqVO.getProjectSubName()) + .like(!StringUtils.isEmpty(reqVO.getMaterialName()), ProcessBomDetailDO::getMaterialName, reqVO.getMaterialName()) + .like(!StringUtils.isEmpty(reqVO.getOwnerName()), AdminUserDO::getNickname, reqVO.getOwnerName()) + .eq(!StringUtils.isEmpty(reqVO.getDispatchDetailId()), TaskInReportDO::getDispatchDetailId, reqVO.getDispatchDetailId()); + if (reqVO.getEndTime() != null) { + LocalDateTime endDateTime = reqVO.getEndTime()[1]; + // 重置时间为 23:59:59 + LocalDateTime endOfDay = endDateTime + .withHour(23) + .withMinute(59) + .withSecond(59); + query.between(TaskReportDO::getReportTime, reqVO.getEndTime()[0], endOfDay); + } + return selectPage(reqVO, query); + } + +} \ 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/service/taskinreport/TaskInReportService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskinreport/TaskInReportService.java new file mode 100644 index 00000000..cb89f2c7 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskinreport/TaskInReportService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.taskinreport; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskinreport.TaskInReportDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 下料报工 Service 接口 + * + * @author 管理员 + */ +public interface TaskInReportService { + + /** + * 创建下料报工 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createTaskInReport(@Valid TaskInReportSaveReqVO createReqVO); + + /** + * 更新下料报工 + * + * @param updateReqVO 更新信息 + */ + void updateTaskInReport(@Valid TaskInReportSaveReqVO updateReqVO); + + /** + * 删除下料报工 + * + * @param id 编号 + */ + void deleteTaskInReport(Long id); + + /** + * 获得下料报工 + * + * @param id 编号 + * @return 下料报工 + */ + TaskInReportDO getTaskInReport(Long id); + + /** + * 获得下料报工分页 + * + * @param pageReqVO 分页查询 + * @return 下料报工分页 + */ + PageResult getTaskInReportPage(TaskInReportPageReqVO pageReqVO); + +} \ 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/service/taskinreport/TaskInReportServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskinreport/TaskInReportServiceImpl.java new file mode 100644 index 00000000..fec63e90 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskinreport/TaskInReportServiceImpl.java @@ -0,0 +1,71 @@ +package com.chanko.yunxi.mes.module.heli.service.taskinreport; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskinreport.TaskInReportDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.taskinreport.TaskInReportMapper; + +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 TaskInReportServiceImpl implements TaskInReportService { + + @Resource + private TaskInReportMapper taskInReportMapper; + + @Override + public Long createTaskInReport(TaskInReportSaveReqVO createReqVO) { + // 插入 + TaskInReportDO taskInReport = BeanUtils.toBean(createReqVO, TaskInReportDO.class); + taskInReportMapper.insert(taskInReport); + // 返回 + return taskInReport.getId(); + } + + @Override + public void updateTaskInReport(TaskInReportSaveReqVO updateReqVO) { + // 校验存在 + validateTaskInReportExists(updateReqVO.getId()); + // 更新 + TaskInReportDO updateObj = BeanUtils.toBean(updateReqVO, TaskInReportDO.class); + taskInReportMapper.updateById(updateObj); + } + + @Override + public void deleteTaskInReport(Long id) { + // 校验存在 + validateTaskInReportExists(id); + // 删除 + taskInReportMapper.deleteById(id); + } + + private void validateTaskInReportExists(Long id) { + if (taskInReportMapper.selectById(id) == null) { + throw exception(TASK_IN_REPORT_NOT_EXISTS); + } + } + + @Override + public TaskInReportDO getTaskInReport(Long id) { + return taskInReportMapper.selectById(id); + } + + @Override + public PageResult getTaskInReportPage(TaskInReportPageReqVO pageReqVO) { + return taskInReportMapper.selectPage(pageReqVO); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/taskinreport/TaskInReportMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/taskinreport/TaskInReportMapper.xml new file mode 100644 index 00000000..e4c49958 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/taskinreport/TaskInReportMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/utils/formatter.ts b/mes-ui/mes-ui-admin-vue3/src/utils/formatter.ts index 8777f322..63548ba3 100644 --- a/mes-ui/mes-ui-admin-vue3/src/utils/formatter.ts +++ b/mes-ui/mes-ui-admin-vue3/src/utils/formatter.ts @@ -5,3 +5,16 @@ import { floatToFixed2 } from '@/utils' export const fenToYuanFormat = (_, __, cellValue: any, ___) => { return `¥${floatToFixed2(cellValue)}` } + +/** 数字格式化为两位小数 */ +const formatNumber = (row: any, column: any, cellValue: any) => { + if (cellValue === null || cellValue === undefined) { + return '-' + } + // 确保是数字类型后再格式化 + const num = Number(cellValue) + if (isNaN(num)) { + return cellValue + } + return num.toFixed(2) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/taskinreport/TaskInReportForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/taskinreport/TaskInReportForm.vue new file mode 100644 index 00000000..ba5c91cd --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/taskinreport/TaskInReportForm.vue @@ -0,0 +1,263 @@ + + + + +