下料报基础代码
This commit is contained in:
parent
c60a522230
commit
d1b3b5fc63
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,3 +26,4 @@ node_modules/
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
target
|
||||
/.flattened-pom.xml
|
||||
|
||||
@ -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 , "下料报工不存在");
|
||||
|
||||
}
|
||||
|
||||
@ -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<Long> createTaskInReport(@Valid @RequestBody TaskInReportSaveReqVO createReqVO) {
|
||||
return success(taskInReportService.createTaskInReport(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新下料报工")
|
||||
@PreAuthorize("@ss.hasPermission('heli:task-in-report:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<TaskInReportRespVO> 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<PageResult<TaskInReportRespVO>> getTaskInReportPage(@Valid TaskInReportPageReqVO pageReqVO) {
|
||||
PageResult<TaskInReportDO> 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<TaskInReportDO> list = taskInReportService.getTaskInReportPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "下料报工.xls", "数据", TaskInReportRespVO.class,
|
||||
BeanUtils.toBean(list, TaskInReportRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
@ -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<TaskInReportDO> {
|
||||
|
||||
|
||||
default PageResult<TaskInReportDO> selectPage(TaskInReportPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<TaskInReportDO> 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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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<TaskInReportDO> getTaskInReportPage(TaskInReportPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -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<TaskInReportDO> getTaskInReportPage(TaskInReportPageReqVO pageReqVO) {
|
||||
return taskInReportMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chanko.yunxi.mes.module.heli.dal.mysql.taskinreport.TaskInReportMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectByPage" resultType="TaskInReportDO">
|
||||
SELECT
|
||||
b.*,
|
||||
owner_user.nickname own_name,
|
||||
updater_user.nickname updater_name,
|
||||
w.in_report_process AS report_process,
|
||||
e.name ,
|
||||
c.material_name as material_name,
|
||||
a.code ,
|
||||
a.project_name as project_name,
|
||||
a1.`name` as project_sub_name
|
||||
FROM pro_task_in_report b
|
||||
LEFT JOIN system_users owner_user ON owner_user.id = b.owner
|
||||
LEFT JOIN system_users updater_user ON updater_user.id = b.updater
|
||||
LEFT JOIN pro_task_dispatch_detail w ON w.id = b.dispatch_detail_id AND w.deleted = '0'
|
||||
LEFT JOIN pro_task_dispatch d on d.id = w.dispatch_id and d.deleted = '0'
|
||||
LEFT JOIN base_procedure e on e.id = w.procedure_id and e.deleted = '0'
|
||||
LEFT JOIN pro_process_bom_detail c on c.id = d.bom_detail_id and c.deleted = '0'
|
||||
LEFT JOIN project_sale_order_sub a1 on a1.id = d.project_sub_id and a1.deleted = '0'
|
||||
LEFT JOIN project_sale_order a on a.id= a1.project_order_id and a.deleted = '0'
|
||||
where b.deleted = '0'
|
||||
order by b.id desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -0,0 +1,263 @@
|
||||
<template>
|
||||
|
||||
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="140px"
|
||||
v-loading="formLoading"
|
||||
class="custom-table"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料类型" prop="matType">
|
||||
<el-select v-model="formData.matType" class="!w-260px" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="密度" prop="density">
|
||||
<el-input-number v-model="formData.density" min="0" :precision="2" class="!w-260px"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单价" prop="price">
|
||||
<el-input-number v-model="formData.price" min="0" :precision="2" class="!w-260px"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="长(直径)(mm)" prop="length">
|
||||
<el-input-number v-model="formData.length" min="0" :precision="2"
|
||||
placeholder="请输入密度"
|
||||
@change="handleDimensionChange"
|
||||
class="!w-260px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="高度(mm)" prop="hight">
|
||||
<el-input-number v-model="formData.hight" min="0" :precision="2"
|
||||
placeholder="请输入高度"
|
||||
@change="handleDimensionChange"
|
||||
class="!w-260px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="宽度(mm)" prop="widht">
|
||||
<el-input-number v-model="formData.widht" min="0" :precision="2"
|
||||
placeholder="请输入单价"
|
||||
@change="handleDimensionChange"
|
||||
class="!w-260px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 第三行 -->
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="重量(Kg)" prop="weight">
|
||||
<el-input-number v-model="formData.weight" min="0" :precision="2"
|
||||
@change="handleReportPriceChange"
|
||||
placeholder="请输入重量" class="!w-260px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="总价" prop="reportPrice">
|
||||
<el-input-number v-model="formData.reportPrice" min="0" :precision="2"
|
||||
class="!w-260px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="计算公式" prop="calFormal">
|
||||
<el-input type="textarea" :rows="3" v-model="formData.calFormal"
|
||||
placeholder="请输入计算公式"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :rows="3" placeholder="请输入备注"
|
||||
v-model="formData.remark"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as TaskInReportApi from '@/api/heli/taskinreport'
|
||||
|
||||
const {t} = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
dispatchDetailId: undefined,
|
||||
owner: undefined,
|
||||
amount: undefined,
|
||||
reportTime: undefined,
|
||||
length: undefined,
|
||||
hasReport: undefined,
|
||||
status: undefined,
|
||||
workType: undefined,
|
||||
remark: undefined,
|
||||
widht: undefined as number | undefined,
|
||||
hight: undefined as number | undefined,
|
||||
density: undefined as number | undefined,
|
||||
weight: undefined as number | undefined,
|
||||
price: undefined as number | undefined,
|
||||
reportPrice: undefined as number | undefined,
|
||||
matType: undefined,
|
||||
formalId: undefined,
|
||||
calFormal: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
length: [{required: true, message: '长(直径)不能为空', trigger: 'blur'}],
|
||||
hight: [{required: true, message: '高度不能为空', trigger: 'blur'}],
|
||||
widht: [{required: true, message: '宽度是不能为空', trigger: 'blur'}],
|
||||
weight: [{required: true, message: '重量不能为空', trigger: 'blur'}],
|
||||
reportPrice: [{required: true, message: '总价不能为空', trigger: 'blur'}],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await TaskInReportApi.getTaskInReport(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({open}) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as TaskInReportApi.TaskInReportVO
|
||||
if (formType.value === 'create') {
|
||||
await TaskInReportApi.createTaskInReport(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await TaskInReportApi.updateTaskInReport(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleReportPriceChange = () => {
|
||||
if (formData.value.weight) {
|
||||
formData.value.reportPrice = Number((formData.value.weight * formData.value.price).toFixed(2));
|
||||
}
|
||||
};
|
||||
const handleDimensionChange = () => {
|
||||
const validateNumericValue = (value) => {
|
||||
return typeof value === 'number' && !isNaN(value) && isFinite(value) && value > 0;
|
||||
};
|
||||
|
||||
const calculateWeight = () => {
|
||||
if (!validateNumericValue(formData.value.length) ||
|
||||
!validateNumericValue(formData.value.hight) ||
|
||||
!validateNumericValue(formData.value.density)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let totalWeight = 0;
|
||||
if (formData.value.matType === "1" || formData.value.matType === "3") {
|
||||
if (!validateNumericValue(formData.value.widht)) {
|
||||
return 0;
|
||||
}
|
||||
totalWeight = Number(
|
||||
(formData.value.length * formData.value.widht * formData.value.hight * formData.value.density) /
|
||||
1000000 * 100
|
||||
).toFixed(2);
|
||||
}
|
||||
if (formData.value.matType === "2") {
|
||||
totalWeight = Number(
|
||||
(3.14 * Math.pow(formData.value.length / 2, 2) * formData.value.hight * formData.value.density) /
|
||||
1000000
|
||||
).toFixed(2);
|
||||
}
|
||||
return totalWeight;
|
||||
};
|
||||
|
||||
formData.value.weight = calculateWeight();
|
||||
|
||||
if (validateNumericValue(formData.value.weight) && validateNumericValue(formData.value.price)) {
|
||||
formData.value.reportPrice = Number(formData.value.weight * formData.value.price).toFixed(2);
|
||||
} else {
|
||||
formData.value.reportPrice = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
// 重置时标记为初始化状态,防止计算覆盖初始数据
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
dispatchDetailId: undefined,
|
||||
owner: undefined,
|
||||
amount: undefined,
|
||||
reportTime: undefined,
|
||||
length: undefined,
|
||||
hasReport: undefined,
|
||||
status: undefined,
|
||||
workType: undefined,
|
||||
remark: undefined,
|
||||
widht: undefined,
|
||||
hight: undefined,
|
||||
density: undefined,
|
||||
weight: undefined,
|
||||
price: undefined,
|
||||
reportPrice: undefined,
|
||||
matType: undefined,
|
||||
formalId: undefined,
|
||||
calFormal: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
/* 全局修改 */
|
||||
.el-form-item {
|
||||
margin-bottom: 32px; /* 改为你想要的间距,比如 32px、40px */
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user