diff --git a/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/enums/OperateTypeEnum.java b/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/enums/OperateTypeEnum.java index 0f8a4259..5cc561ad 100644 --- a/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/enums/OperateTypeEnum.java +++ b/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/enums/OperateTypeEnum.java @@ -72,6 +72,14 @@ public enum OperateTypeEnum { * 发货 * */ DELIVER(14), + /* + * 提交 + * */ + SUBMIT(15), + /* + * 取消提交 + * */ + CANCEL_SUBMIT(16), /** * 其它 * diff --git a/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkService.java b/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkService.java index 3e55b025..475922b0 100644 --- a/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkService.java +++ b/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkService.java @@ -28,4 +28,15 @@ public interface OperateLogFrameworkService { * @param content */ void createOperateLog(HttpServletRequest request, LocalDateTime startTime, String businessType, Long businessId, Integer type, String content); + + /** + * 记录操作日志 + * + * @param startTime + * @param businessType + * @param businessId + * @param type + * @param content + */ + void createOperateLog(LocalDateTime startTime, String businessType, Long businessId, Integer type, String content); } diff --git a/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkServiceImpl.java b/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkServiceImpl.java index 9f1624e4..45249470 100644 --- a/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkServiceImpl.java +++ b/mes-framework/mes-spring-boot-starter-biz-operatelog/src/main/java/com/chanko/yunxi/mes/framework/operatelog/core/service/OperateLogFrameworkServiceImpl.java @@ -58,4 +58,28 @@ public class OperateLogFrameworkServiceImpl implements OperateLogFrameworkServic operateLogApi.createOperateLog(reqDTO); } + @Override + public void createOperateLog(LocalDateTime startTime, String businessType, Long businessId, Integer type, String content) { + OperateLog operateLogObj = new OperateLog(); + operateLogObj.setTraceId(TracerUtils.getTraceId()); + operateLogObj.setStartTime(startTime); + operateLogObj.setBusinessType(businessType); + operateLogObj.setBusinessId(businessId); + operateLogObj.setUserId(WebFrameworkUtils.getLoginUserId()); + operateLogObj.setUserType(WebFrameworkUtils.getLoginUserType()); + operateLogObj.setModule("ignore"); + operateLogObj.setName("ignore"); + operateLogObj.setType(type); + operateLogObj.setContent(content); + operateLogObj.setRequestMethod("system"); + operateLogObj.setRequestUrl("system"); + operateLogObj.setUserIp("127.0.0.1"); + operateLogObj.setUserAgent("system"); + operateLogObj.setJavaMethod("system"); + operateLogObj.setDuration((int) (LocalDateTimeUtil.between(startTime, LocalDateTime.now()).toMillis())); + operateLogObj.setResultCode(SUCCESS.getCode()); + OperateLogCreateReqDTO reqDTO = BeanUtil.toBean(operateLogObj, OperateLogCreateReqDTO.class); + operateLogApi.createOperateLog(reqDTO); + } + } diff --git a/mes-framework/mes-spring-boot-starter-excel/src/main/java/com/chanko/yunxi/mes/framework/excel/core/convert/TimestampToDateConvert.java b/mes-framework/mes-spring-boot-starter-excel/src/main/java/com/chanko/yunxi/mes/framework/excel/core/convert/TimestampToDateConvert.java new file mode 100644 index 00000000..30a82f4c --- /dev/null +++ b/mes-framework/mes-spring-boot-starter-excel/src/main/java/com/chanko/yunxi/mes/framework/excel/core/convert/TimestampToDateConvert.java @@ -0,0 +1,42 @@ +package com.chanko.yunxi.mes.framework.excel.core.convert; + + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; + +/** + * 日期转换器 + * + * @author chenxi + * @date 2024-02-28 09:01 + */ +public class TimestampToDateConvert implements Converter { + + @Override + public WriteCellData convertToExcelData(Object value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + try { + String date = ""; + if(value instanceof Long){ + long timestamp = (Long) value; + date = new SimpleDateFormat("yyyy-MM-dd").format(new Date(timestamp)); + }else if(value instanceof String){ + long timestamp = Long.parseLong((String) value); + date = new SimpleDateFormat("yyyy-MM-dd").format(new Date(timestamp)); + }else if(value instanceof LocalDateTime){ + LocalDateTime local = (LocalDateTime) value; + date = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(local); + } + return new WriteCellData<>(date); + }catch (Exception e){ + } + return Converter.super.convertToExcelData(value, contentProperty, globalConfiguration); + } + +} diff --git a/mes-module-heli/mes-module-heli-api/pom.xml b/mes-module-heli/mes-module-heli-api/pom.xml index a19c2328..d2839a86 100644 --- a/mes-module-heli/mes-module-heli-api/pom.xml +++ b/mes-module-heli/mes-module-heli-api/pom.xml @@ -28,6 +28,12 @@ spring-boot-starter-validation true + + + org.springdoc + springdoc-openapi-ui + provided + diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/BusinesTypeEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/BusinesTypeEnum.java index dff0dbb2..c3f95961 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/BusinesTypeEnum.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/BusinesTypeEnum.java @@ -13,6 +13,7 @@ public enum BusinesTypeEnum { PROJECT_ORDER("销售订单"), PROJECT_ORDER_SNAPSHOT("销售订单快照"), DELIVER_ORDER("发货订单"), + PROCESS_BOM("工艺BOM"), ; private String description; 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 54355069..8d8c3a7a 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 @@ -43,6 +43,9 @@ public enum CodeEnum { STOCK_CHECK("盘点单据", "WC", 3, "yyyyMM"), PROJECT_ORDER("业务订单", 3, "yyyyMM"), PROJECT_DELIVERY_ORDER("发货单", "HL", 3, "yyyyMM"), + PROJECT_PLAN("生产计划", "PP",3, "yyyyMM"), + MATERIAL_PLAN("物料需求计划", "PR",4, "yyyyMMdd"), + PURCHASE_ORDER("采购订单", "PO",4, "yyyyMMdd"), ; 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 fdd9b8a0..f558439b 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 @@ -17,6 +17,9 @@ import com.chanko.yunxi.mes.framework.common.exception.ErrorCode; * 004 订单管理 * 005 发货管理 * 006 工艺设计 + * 007 生产计划 + * 008 采购管理 + * 009 生产管理 * 第三段,3 位,错误码 */ public interface ErrorCodeConstants { @@ -57,4 +60,16 @@ public interface ErrorCodeConstants { ErrorCode DELIVER_AMOUNT_OVERFLOW = new ErrorCode(1_005_003, "超额发货"); /************工艺设计***********/ ErrorCode PROCESS_DESIGN_NOT_EXISTS = new ErrorCode(1_006_001, "工艺设计不存在"); + ErrorCode PROCESS_BOM_NOT_EXISTS = new ErrorCode(1_006_002, "工艺bom不存在"); + ErrorCode PROCESS_BOM_DETAIL_NOT_EXISTS = new ErrorCode(1_006_003, "工艺bom明细不存在"); + /************生产计划管理***********/ + ErrorCode PLAN_NOT_EXISTS = new ErrorCode(1_007_001, "生产计划不存在"); + ErrorCode PLAN_SUB_NOT_EXISTS = new ErrorCode(1_007_002, "生产计划子项目不存在"); + /************采购管理***********/ + ErrorCode MATERIAL_PLAN_NOT_EXISTS = new ErrorCode(1_008_001, "物料需求计划不存在"); + ErrorCode MATERIAL_PLAN_DETAIL_NOT_EXISTS = new ErrorCode(1_008_002, "物料需求计划物料详情不存在"); + ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_008_003, "采购订单不存在"); + ErrorCode PURCHASE_ORDER_MATERIAL_NOT_EXISTS = new ErrorCode(1_008_004, "采购单物料不存在"); + /************生产管理***********/ + ErrorCode TASK_DISPATCH_NOT_EXISTS = new ErrorCode(1_009_001, "派工单不存在"); } diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProcessBomStatusEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProcessBomStatusEnum.java new file mode 100644 index 00000000..a5fee1ca --- /dev/null +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProcessBomStatusEnum.java @@ -0,0 +1,25 @@ +package com.chanko.yunxi.mes.module.heli.enums; + +import lombok.Getter; + +/** + * 工艺bom状态枚举 + * @author chenxi + * @date 2024-02-26 11:25 + */ +@Getter +public enum ProcessBomStatusEnum { + + SAVE(1, "已保存"), + SUBMIT(2, "已提交"), + CANCEL_SUBMIT(1, "取消提交"), + TERMINATE(3, "已终止"); + + private int code; + private String description; + + ProcessBomStatusEnum(int code, String description) { + this.code = code; + this.description = description; + } +} diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProcessDesignTypeEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProcessDesignTypeEnum.java new file mode 100644 index 00000000..dc183583 --- /dev/null +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProcessDesignTypeEnum.java @@ -0,0 +1,23 @@ +package com.chanko.yunxi.mes.module.heli.enums; + +import lombok.Getter; + +/** + * 工艺设计类型枚举 + * @author chenxi + * @date 2024-02-21 01:09 + */ +@Getter +public enum ProcessDesignTypeEnum { + + BLUEPRINT_FOUNDRY_TECHNOLOGY("铸造工艺"), + BLUEPRINT_3D("3D图纸"), + BLUEPRINT_2D("2D图纸"), + BLUEPRINT_WORKBLANK("毛坯图纸"); + + private String description; + + ProcessDesignTypeEnum(String description) { + this.description = description; + } +} diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProjectPlanStatusEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProjectPlanStatusEnum.java new file mode 100644 index 00000000..144cf57a --- /dev/null +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ProjectPlanStatusEnum.java @@ -0,0 +1,26 @@ +package com.chanko.yunxi.mes.module.heli.enums; + +import lombok.Getter; + +/** + * 项目订单状态枚举 + * @author chenxi + * @date 2024-01-18 01:19 + */ +@Getter +public enum ProjectPlanStatusEnum { + START(1, "未开始"), + PRODUCING(2, "生产中"), + COMPLETE(3, "已完成"), + TERMINATE(4, "已终止"), + CHANGE(5, "已变更"), + ; + + private int code; + private String description; + + ProjectPlanStatusEnum(int code, String description) { + this.code = code; + this.description = description; + } +} diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/PurchaseStatusEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/PurchaseStatusEnum.java new file mode 100644 index 00000000..8478de34 --- /dev/null +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/PurchaseStatusEnum.java @@ -0,0 +1,25 @@ +package com.chanko.yunxi.mes.module.heli.enums; + +import lombok.Getter; + +/** + * 项目订单状态枚举 + * @author chenxi + * @date 2024-01-18 01:19 + */ +@Getter +public enum PurchaseStatusEnum { + START(1, "已保存"), + SUBMIT(2, "已送审"), + AUDIT(3, "已审核"), + REFUSE(4, "已打回"), + ; + + private int code; + private String description; + + PurchaseStatusEnum(int code, String description) { + this.code = code; + this.description = description; + } +} diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ValidStatusEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ValidStatusEnum.java new file mode 100644 index 00000000..7820f42f --- /dev/null +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ValidStatusEnum.java @@ -0,0 +1,22 @@ +package com.chanko.yunxi.mes.module.heli.enums; + +import lombok.Getter; + +/** + * 有效状态枚举 + * @author chenxi + * @date 2024-02-27 10:28 + */ +@Getter +public enum ValidStatusEnum { + VALID(1, "有效"), + INVALID(2, "无效"); + + private int code; + private String description; + + ValidStatusEnum(int code, String description) { + this.code = code; + this.description = description; + } +} diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/WarningEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/WarningEnum.java new file mode 100644 index 00000000..a776181f --- /dev/null +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/WarningEnum.java @@ -0,0 +1,20 @@ +package com.chanko.yunxi.mes.module.heli.enums; + +import lombok.Getter; + +/** + * 预警类型 + * @author chenxi + * @date 2024-02-23 10:15 + */ +@Getter +public enum WarningEnum { + + PROCESS_DESIGN_DEFERRED_WARNING("工艺设计延期预警"); + + private String description; + + WarningEnum(String description) { + this.description = description; + } +} diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/vo/WarningMessageVO.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/vo/WarningMessageVO.java new file mode 100644 index 00000000..efcdd3e8 --- /dev/null +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/vo/WarningMessageVO.java @@ -0,0 +1,56 @@ +package com.chanko.yunxi.mes.module.heli.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 预警信息 + * + * @author chenxi + * @date 2024-02-23 09:54 + */ +@Data +@Accessors(chain = true) +public class WarningMessageVO { + + @Schema(description = "是否包含预警信息") + private boolean hasWarning = false; + + @Schema(description = "预警信息") + private List warnings; + + + public static abstract class WarningVO {} + + @Data + @Accessors(chain = true) + public static class ProcessDesignDeferredWarningVO extends WarningVO { + + /** + * {@link com.chanko.yunxi.mes.module.heli.enums.WarningEnum} + */ + @Schema(description = "预警类型") + private String warningType; + + /** + * {@link com.chanko.yunxi.mes.module.heli.enums.ProcessDesignTypeEnum} + */ + @Schema(description = "工艺设计类型") + private String processDesignType; + + @Schema(description = "预警接收人") + private String ownerName; + + @Schema(description = "项目编号") + private String projectCode; + + @Schema(description = "子项目编号") + private String projectSubCode; + + @Schema(description = "剩余时间") + private long remainingTime; + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerPageReqVO.java index c4bda50a..c03e9b22 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerPageReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/customer/vo/CustomerPageReqVO.java @@ -119,4 +119,7 @@ public class CustomerPageReqVO extends PageParam { @Schema(description = "公司税号") private String taxNo; -} \ No newline at end of file + @Schema(description = "简称或全称") + private String briefOrName; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/EquipController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/EquipController.java index 9cfdcd19..06fec576 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/EquipController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/equip/EquipController.java @@ -1,95 +1,110 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.equip; - -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.equip.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; -import com.chanko.yunxi.mes.module.heli.service.equip.EquipService; - -@Tag(name = "管理后台 - 设备信息") -@RestController -@RequestMapping("/heli/equip") -@Validated -public class EquipController { - - @Resource - private EquipService equipService; - - @PostMapping("/create") - @Operation(summary = "创建设备信息") - @PreAuthorize("@ss.hasPermission('heli:equip:create')") - public CommonResult createEquip(@Valid @RequestBody EquipSaveReqVO createReqVO) { - return success(equipService.createEquip(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新设备信息") - @PreAuthorize("@ss.hasPermission('heli:equip:update')") - public CommonResult updateEquip(@Valid @RequestBody EquipSaveReqVO updateReqVO) { - equipService.updateEquip(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除设备信息") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:equip:delete')") - public CommonResult deleteEquip(@RequestParam("id") Long id) { - equipService.deleteEquip(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得设备信息") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:equip:query')") - public CommonResult getEquip(@RequestParam("id") Long id) { - EquipDO equip = equipService.getEquip(id); - return success(BeanUtils.toBean(equip, EquipRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得设备信息分页") - @PreAuthorize("@ss.hasPermission('heli:equip:query')") - public CommonResult> getEquipPage(@Valid EquipPageReqVO pageReqVO) { - PageResult pageResult = equipService.getEquipPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, EquipRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出设备信息 Excel") - @PreAuthorize("@ss.hasPermission('heli:equip:export')") - @OperateLog(type = EXPORT) - public void exportEquipExcel(@Valid EquipPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = equipService.getEquipPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "设备信息.xls", "数据", EquipRespVO.class, - BeanUtils.toBean(list, EquipRespVO.class)); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.equip; + +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.equip.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; +import com.chanko.yunxi.mes.module.heli.service.equip.EquipService; + +@Tag(name = "管理后台 - 设备信息") +@RestController +@RequestMapping("/heli/equip") +@Validated +public class EquipController { + + @Resource + private EquipService equipService; + + @PostMapping("/create") + @Operation(summary = "创建设备信息") + @PreAuthorize("@ss.hasPermission('heli:equip:create')") + public CommonResult createEquip(@Valid @RequestBody EquipSaveReqVO createReqVO) { + return success(equipService.createEquip(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新设备信息") + @PreAuthorize("@ss.hasPermission('heli:equip:update')") + public CommonResult updateEquip(@Valid @RequestBody EquipSaveReqVO updateReqVO) { + equipService.updateEquip(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除设备信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:equip:delete')") + public CommonResult deleteEquip(@RequestParam("id") Long id) { + equipService.deleteEquip(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得设备信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:equip:query')") + public CommonResult getEquip(@RequestParam("id") Long id) { + EquipDO equip = equipService.getEquip(id); + return success(BeanUtils.toBean(equip, EquipRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得设备信息分页") + @PreAuthorize("@ss.hasPermission('heli:equip:query')") + public CommonResult> getEquipPage(@Valid EquipPageReqVO pageReqVO) { + PageResult pageResult = equipService.getEquipPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, EquipRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出设备信息 Excel") + @PreAuthorize("@ss.hasPermission('heli:equip:export')") + @OperateLog(type = EXPORT) + public void exportEquipExcel(@Valid EquipPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = equipService.getEquipPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "设备信息.xls", "数据", EquipRespVO.class, + BeanUtils.toBean(list, EquipRespVO.class)); + } + + @GetMapping({"/all-simples"}) + @Operation(summary = "TODO:获取设备信息信息列表", description = "只包含被开启的设备信息,主要用于前端的下拉选项") + public CommonResult> > getSimpleList() { + List> list = equipService.getEquipSimpleList(); + // 拼接数据 + return success(list); + } + + @GetMapping({"/all-no-status-simples"}) + @Operation(summary = "TODO:获取无状态设备信息信息列表", description = "设备信息,主要用于前端的下拉选项") + public CommonResult> > getNoStatusSimpleList() { + List> list = equipService.getEquipNoStatusSimpleList(); + // 拼接数据 + return success(list); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialPageReqVO.java index 2f3048c1..249f8aba 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialPageReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialPageReqVO.java @@ -24,6 +24,9 @@ public class MaterialPageReqVO extends PageParam { @Schema(description = "物料名称", example = "李四") private String name; + @Schema(description = "物料名称", example = "李四") + private String codeAndName; + @Schema(description = "品牌") private String brand; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java index 5b0b4006..58380b30 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java @@ -27,6 +27,9 @@ public class MaterialRespVO { @ExcelProperty("物料名称") private String name; + @Schema(description = "物料名称和编码") + private String codeAndName; + @Schema(description = "品牌") @ExcelProperty("品牌") private String brand; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/MaterialPlanController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/MaterialPlanController.java new file mode 100644 index 00000000..af6cc4cf --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/MaterialPlanController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan; + +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.materialplan.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO; +import com.chanko.yunxi.mes.module.heli.service.materialplan.MaterialPlanService; + +@Tag(name = "管理后台 - 物料需求计划") +@RestController +@RequestMapping("/heli/material-plan") +@Validated +public class MaterialPlanController { + + @Resource + private MaterialPlanService materialPlanService; + + @PostMapping("/create") + @Operation(summary = "创建物料需求计划") + @PreAuthorize("@ss.hasPermission('heli:material-plan:create')") + public CommonResult createMaterialPlan(@Valid @RequestBody MaterialPlanSaveReqVO createReqVO) { + return success(materialPlanService.createMaterialPlan(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新物料需求计划") + @PreAuthorize("@ss.hasPermission('heli:material-plan:update')") + public CommonResult updateMaterialPlan(@Valid @RequestBody MaterialPlanSaveReqVO updateReqVO) { + materialPlanService.updateMaterialPlan(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除物料需求计划") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:material-plan:delete')") + public CommonResult deleteMaterialPlan(@RequestParam("id") Long id) { + materialPlanService.deleteMaterialPlan(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得物料需求计划") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:material-plan:query')") + public CommonResult getMaterialPlan(@RequestParam("id") Long id) { + MaterialPlanDO materialPlan = materialPlanService.getMaterialPlan(id); + return success(BeanUtils.toBean(materialPlan, MaterialPlanRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得物料需求计划分页") + @PreAuthorize("@ss.hasPermission('heli:material-plan:query')") + public CommonResult> getMaterialPlanPage(@Valid MaterialPlanPageReqVO pageReqVO) { + PageResult pageResult = materialPlanService.getMaterialPlanPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MaterialPlanRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出物料需求计划 Excel") + @PreAuthorize("@ss.hasPermission('heli:material-plan:export')") + @OperateLog(type = EXPORT) + public void exportMaterialPlanExcel(@Valid MaterialPlanPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = materialPlanService.getMaterialPlanPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "物料需求计划.xls", "数据", MaterialPlanRespVO.class, + BeanUtils.toBean(list, MaterialPlanRespVO.class)); + } + +} \ 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/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 new file mode 100644 index 00000000..6ab6858a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanPageReqVO.java @@ -0,0 +1,60 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +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") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MaterialPlanPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一") + private Long id; + + @Schema(description = "物料计划单号") + private String projectMaterialPlanNo; + + @Schema(description = "生产计划单号") + private String planNo; + + @Schema(description = "项目名称") + private String projectName; + + @Schema(description = "订单id") + private Long projectId; + + @Schema(description = "生产计划id") + private Long projectPlanId; + + @Schema(description = "送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] submitTime; + + @Schema(description = "审核人") + private Long auditor; + + @Schema(description = "审核时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] auditTime; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + private Integer status; + + @Schema(description = "备注") + private String description; + + @Schema(description = "创建时间") + 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 new file mode 100644 index 00000000..d6353fa9 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanRespVO.java @@ -0,0 +1,75 @@ +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 java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat; +import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 物料需求计划 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MaterialPlanRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "物料计划单号", requiredMode = Schema.RequiredMode.REQUIRED) + @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; + + @Schema(description = "生产计划id") + @ExcelProperty("生产计划id") + private Long projectPlanId; + + @Schema(description = "送审人") + @ExcelProperty("送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + @ExcelProperty("送审时间") + private LocalDateTime submitTime; + + @Schema(description = "审核人") + @ExcelProperty("审核人") + private Long auditor; + + @Schema(description = "审核时间") + @ExcelProperty("审核时间") + private LocalDateTime auditTime; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + @ExcelProperty(value = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1", converter = DictConvert.class) + @DictFormat("heli_project_material_plan_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer status; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String description; + + @Schema(description = "创建人") + @ExcelProperty("创建人") + private Long creator; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime 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/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 new file mode 100644 index 00000000..3cea6416 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplan/vo/MaterialPlanSaveReqVO.java @@ -0,0 +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) + 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/materialplandetail/MaterialPlanDetailController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/MaterialPlanDetailController.java new file mode 100644 index 00000000..45fcc896 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/MaterialPlanDetailController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail; + +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.materialplandetail.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO; +import com.chanko.yunxi.mes.module.heli.service.materialplandetail.MaterialPlanDetailService; + +@Tag(name = "管理后台 - 物料需求计划物料详情") +@RestController +@RequestMapping("/heli/material-plan-detail") +@Validated +public class MaterialPlanDetailController { + + @Resource + private MaterialPlanDetailService materialPlanDetailService; + + @PostMapping("/create") + @Operation(summary = "创建物料需求计划物料详情") + @PreAuthorize("@ss.hasPermission('heli:material-plan-detail:create')") + public CommonResult createMaterialPlanDetail(@Valid @RequestBody MaterialPlanDetailSaveReqVO createReqVO) { + return success(materialPlanDetailService.createMaterialPlanDetail(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新物料需求计划物料详情") + @PreAuthorize("@ss.hasPermission('heli:material-plan-detail:update')") + public CommonResult updateMaterialPlanDetail(@Valid @RequestBody MaterialPlanDetailSaveReqVO updateReqVO) { + materialPlanDetailService.updateMaterialPlanDetail(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除物料需求计划物料详情") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:material-plan-detail:delete')") + public CommonResult deleteMaterialPlanDetail(@RequestParam("id") Long id) { + materialPlanDetailService.deleteMaterialPlanDetail(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得物料需求计划物料详情") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:material-plan-detail:query')") + public CommonResult getMaterialPlanDetail(@RequestParam("id") Long id) { + MaterialPlanDetailDO materialPlanDetail = materialPlanDetailService.getMaterialPlanDetail(id); + return success(BeanUtils.toBean(materialPlanDetail, MaterialPlanDetailRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得物料需求计划物料详情分页") + @PreAuthorize("@ss.hasPermission('heli:material-plan-detail:query')") + public CommonResult> getMaterialPlanDetailPage(@Valid MaterialPlanDetailPageReqVO pageReqVO) { + PageResult pageResult = materialPlanDetailService.getMaterialPlanDetailPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MaterialPlanDetailRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出物料需求计划物料详情 Excel") + @PreAuthorize("@ss.hasPermission('heli:material-plan-detail:export')") + @OperateLog(type = EXPORT) + public void exportMaterialPlanDetailExcel(@Valid MaterialPlanDetailPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = materialPlanDetailService.getMaterialPlanDetailPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "物料需求计划物料详情.xls", "数据", MaterialPlanDetailRespVO.class, + BeanUtils.toBean(list, MaterialPlanDetailRespVO.class)); + } + +} \ 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/materialplandetail/vo/MaterialPlanDetailPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/vo/MaterialPlanDetailPageReqVO.java new file mode 100644 index 00000000..960113f2 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/vo/MaterialPlanDetailPageReqVO.java @@ -0,0 +1,46 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo; + +import lombok.*; + +import java.math.BigDecimal; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +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_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 物料需求计划物料详情分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MaterialPlanDetailPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一") + private Long id; + + @Schema(description = "物料需求采购计划id") + private Long projectMaterialPlanId; + + @Schema(description = "物料id") + private Long materialId; + + @Schema(description = "子项目编号") + private Long projectSubId; + + @Schema(description = "需求数量") + private BigDecimal requireAmount; + + @Schema(description = "需求到货日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] requireArriveTime; + + @Schema(description = "备注") + private String description; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] 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/materialplandetail/vo/MaterialPlanDetailRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/vo/MaterialPlanDetailRespVO.java new file mode 100644 index 00000000..03c1bb86 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/vo/MaterialPlanDetailRespVO.java @@ -0,0 +1,74 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.math.BigDecimal; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 物料需求计划物料详情 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MaterialPlanDetailRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "物料需求采购计划id", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("物料需求采购计划id") + private Long projectMaterialPlanId; + + @Schema(description = "物料id", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("物料id") + private Long materialId; + + @Schema(description = "子项目编号") + @ExcelProperty("子项目编号") + private Long projectSubId; + + @Schema(description = "需求数量") + @ExcelProperty("需求数量") + private BigDecimal requireAmount; + + @Schema(description = "需求到货日期") + @ExcelProperty("需求到货日期") + private LocalDateTime requireArriveTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String description; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "物料id", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("物料id") + private Long matId; + + @Schema(description = "备注") + @ExcelProperty("物料名称") + private String matName; + + @Schema(description = "备注") + @ExcelProperty("物料编码") + private String matCode; + + @Schema(description = "备注") + @ExcelProperty("物料规格型号") + private String matSpec; + + @Schema(description = "备注") + @ExcelProperty("物料单位") + private String matUnit; + + @Schema(description = "备注") + @ExcelProperty("物料类型") + private String matType; + +} \ 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/materialplandetail/vo/MaterialPlanDetailSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/vo/MaterialPlanDetailSaveReqVO.java new file mode 100644 index 00000000..2579ec54 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/materialplandetail/vo/MaterialPlanDetailSaveReqVO.java @@ -0,0 +1,40 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.math.BigDecimal; +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 MaterialPlanDetailSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "物料需求采购计划id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "物料需求采购计划id不能为空") + private Long projectMaterialPlanId; + + @Schema(description = "物料id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "物料id不能为空") + private Long materialId; + + @Schema(description = "子项目编号") + private Long projectSubId; + + @Schema(description = "需求数量") + private BigDecimal requireAmount; + + @Schema(description = "需求到货日期") + private LocalDateTime requireArriveTime; + + @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/mouldtype/MouldTypeController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/mouldtype/MouldTypeController.java index f98d86a7..f511ff1b 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/mouldtype/MouldTypeController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/mouldtype/MouldTypeController.java @@ -99,4 +99,12 @@ public class MouldTypeController { // 拼接数据 return success(list); } + + @GetMapping({"/all-no-status-simples"}) + @Operation(summary = "TODO:获取无状态模块类型信息列表", description = "模块类型,主要用于前端的下拉选项") + public CommonResult> > getNoStatusSimpleList() { + List> list = mouldTypeService.getMouldTypeNoStatusSimpleList(); + // 拼接数据 + return success(list); + } } 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 new file mode 100644 index 00000000..ffceee0e --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/PlanController.java @@ -0,0 +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("/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/controller/admin/plan/vo/PlanPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/vo/PlanPageReqVO.java new file mode 100644 index 00000000..6fcb9f9d --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/vo/PlanPageReqVO.java @@ -0,0 +1,96 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +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_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 生产计划分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PlanPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一", example = "15769") + private Long id; + + @Schema(description = "计划单号") + private String planNo; + + @Schema(description = "项目id") + private Long projectId; + + @Schema(description = "项目编号") + private String projectCode; + + @Schema(description = "客户名称") + private String businessManName; + + @Schema(description = "项目名称") + private String projectName; + + @Schema(description = "业务员") + private String customerName; + + @Schema(description = "业务线") + private String businessLine; + + @Schema(description = "性质") + private Integer property; + + @Schema(description = "项目负责人") + private String projectOwner; + + @Schema(description = "是否需要工艺:1表示需要,0表示不需要") + private Integer hasCraft; + + @Schema(description = "工艺负责人") + private String craftOwner; + + @Schema(description = "工艺开始日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] craftStartDate; + + @Schema(description = "工艺结束日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] craftEndDate; + + @Schema(description = "编辑人") + private String editor; + + @Schema(description = "编辑日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] editorDate; + + @Schema(description = "审核人") + private String auditor; + + @Schema(description = "审核日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] auditDate; + + @Schema(description = "批准人") + private String approver; + + @Schema(description = "批准日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] approveDate; + + @Schema(description = "备注", example = "随便") + private String description; + + @Schema(description = "状态,1未开始,2生产中,3已完成,4已终止 ,默认是1", example = "2") + private Integer status; + + @Schema(description = "项目变更次数") + private Integer changeNum; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] 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/plan/vo/PlanRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/vo/PlanRespVO.java new file mode 100644 index 00000000..3be5214b --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/vo/PlanRespVO.java @@ -0,0 +1,139 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat; +import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 生产计划 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PlanRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "15769") + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "计划单号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("计划单号") + private String planNo; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28157") + @ExcelProperty("项目id") + private Long projectId; + + @Schema(description = "项目负责人") + @ExcelProperty("项目负责人") + private Long projectOwner; + + @Schema(description = "项目编码") + @ExcelProperty("项目编码") + private String projectCode; + + @Schema(description = "客户名称") + @ExcelProperty("客户名称") + private String customerName; + + @Schema(description = "项目名称") + @ExcelProperty("项目名称") + private String projectName; + + @Schema(description = "业务员") + @ExcelProperty("业务员") + private String businessManName; + + @Schema(description = "项目开始日期") + @ExcelProperty("项目开始日期") + private LocalDateTime projectStartTime; + + @Schema(description = "项目结束日期") + @ExcelProperty("项目结束日期") + private LocalDateTime projectEndTime; + + @Schema(description = "业务线") + @ExcelProperty("业务线") + private String businessLine; + + @Schema(description = "性质") + @ExcelProperty("性质") + private Integer property; + + @Schema(description = "是否已变更") + @ExcelProperty("是否已变更") + private Integer hasAlter; + + @Schema(description = "是否紧急") + @ExcelProperty("是否紧急") + private Integer isUrgency; + + @Schema(description = "是否需要工艺:1表示需要,0表示不需要") + @ExcelProperty(value = "是否需要工艺:1表示需要,0表示不需要", converter = DictConvert.class) + @DictFormat("heli_common_is_or_not") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer hasCraft; + + @Schema(description = "工艺负责人") + @ExcelProperty("工艺负责人") + private Long craftOwner; + + @Schema(description = "工艺开始日期") + @ExcelProperty("工艺开始日期") + private LocalDateTime craftStartDate; + + @Schema(description = "工艺结束日期") + @ExcelProperty("工艺结束日期") + private LocalDateTime craftEndDate; + + @Schema(description = "工艺流程数组信息[{'id':1,'sdate':'','edate':'','owner':'','description':''}]") + @ExcelProperty("工艺流程数组信息[{'id':1,'sdate':'','edate':'','owner':'','description':''}]") + private String craftContent; + + @Schema(description = "编辑人") + @ExcelProperty("编辑人") + private Long editor; + + @Schema(description = "编辑日期") + @ExcelProperty("编辑日期") + private LocalDateTime editorDate; + + @Schema(description = "审核人") + @ExcelProperty("审核人") + private Long auditor; + + @Schema(description = "审核日期") + @ExcelProperty("审核日期") + private LocalDateTime auditDate; + + @Schema(description = "批准人") + @ExcelProperty("批准人") + private Long approver; + + @Schema(description = "批准日期") + @ExcelProperty("批准日期") + private LocalDateTime approveDate; + + @Schema(description = "备注", example = "随便") + @ExcelProperty("备注") + private String description; + + @Schema(description = "状态,1未开始,2生产中,3已完成,4已终止 ,默认是1", example = "2") + @ExcelProperty("状态,1未开始,2生产中,3已完成,4已终止 ,默认是1") + private Integer status; + + @Schema(description = "项目变更次数") + @ExcelProperty("项目变更次数") + private Integer changeNum; + + @Schema(description = "项目变更日期") + @ExcelProperty("项目变更日期") + private LocalDateTime changeLastDate; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime 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/plan/vo/PlanSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/vo/PlanSaveReqVO.java new file mode 100644 index 00000000..84b0d81c --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plan/vo/PlanSaveReqVO.java @@ -0,0 +1,70 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.plan.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 PlanSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "15769") + private Long id; + + @Schema(description = "计划单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String planNo; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28157") + @NotNull(message = "项目id不能为空") + private Long projectId; + + @Schema(description = "项目负责人") + private String projectOwner; + + @Schema(description = "是否需要工艺:1表示需要,0表示不需要") + private Integer hasCraft; + + @Schema(description = "工艺负责人") + private String craftOwner; + + @Schema(description = "工艺开始日期") + private LocalDateTime craftStartDate; + + @Schema(description = "工艺结束日期") + private LocalDateTime craftEndDate; + + @Schema(description = "工艺流程数组信息[{'id':1,'sdate':'','edate':'','owner':'','description':''}]") + private String craftContent; + + @Schema(description = "编辑人") + private String editor; + + @Schema(description = "编辑日期") + private LocalDateTime editorDate; + + @Schema(description = "审核人") + private String auditor; + + @Schema(description = "审核日期") + private LocalDateTime auditDate; + + @Schema(description = "批准人") + private String approver; + + @Schema(description = "批准日期") + private LocalDateTime approveDate; + + @Schema(description = "备注", example = "随便") + private String description; + + @Schema(description = "状态,1未开始,2生产中,3已完成,4已终止 ,默认是1", example = "2") + private Boolean status; + + @Schema(description = "项目变更次数") + private Integer changeNum; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/PlanSubController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/PlanSubController.java new file mode 100644 index 00000000..3ae9ec87 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/PlanSubController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.plansub; + +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.plansub.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plansub.PlanSubDO; +import com.chanko.yunxi.mes.module.heli.service.plansub.PlanSubService; + +@Tag(name = "管理后台 - 生产计划子项目") +@RestController +@RequestMapping("/heli/plan-sub") +@Validated +public class PlanSubController { + + @Resource + private PlanSubService planSubService; + + @PostMapping("/create") + @Operation(summary = "创建生产计划子项目") + @PreAuthorize("@ss.hasPermission('heli:plan-sub:create')") + public CommonResult createPlanSub(@Valid @RequestBody PlanSubSaveReqVO createReqVO) { + return success(planSubService.createPlanSub(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新生产计划子项目") + @PreAuthorize("@ss.hasPermission('heli:plan-sub:update')") + public CommonResult updatePlanSub(@Valid @RequestBody PlanSubSaveReqVO updateReqVO) { + planSubService.updatePlanSub(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除生产计划子项目") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:plan-sub:delete')") + public CommonResult deletePlanSub(@RequestParam("id") Long id) { + planSubService.deletePlanSub(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得生产计划子项目") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:plan-sub:query')") + public CommonResult getPlanSub(@RequestParam("id") Long id) { + PlanSubDO planSub = planSubService.getPlanSub(id); + return success(BeanUtils.toBean(planSub, PlanSubRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得生产计划子项目分页") + @PreAuthorize("@ss.hasPermission('heli:plan-sub:query')") + public CommonResult> getPlanSubPage(@Valid PlanSubPageReqVO pageReqVO) { + PageResult pageResult = planSubService.getPlanSubPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PlanSubRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出生产计划子项目 Excel") + @PreAuthorize("@ss.hasPermission('heli:plan-sub:export')") + @OperateLog(type = EXPORT) + public void exportPlanSubExcel(@Valid PlanSubPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = planSubService.getPlanSubPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "生产计划子项目.xls", "数据", PlanSubRespVO.class, + BeanUtils.toBean(list, PlanSubRespVO.class)); + } + +} \ 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/plansub/vo/PlanSubPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/vo/PlanSubPageReqVO.java new file mode 100644 index 00000000..46ba7273 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/vo/PlanSubPageReqVO.java @@ -0,0 +1,61 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.plansub.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +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_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 生产计划子项目分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PlanSubPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一") + private Long id; + + @Schema(description = "计划id") + private Long projectPlanId; + + @Schema(description = "项目id") + private Long projectId; + + @Schema(description = "子项目id") + private Long projectSubId; + + @Schema(description = "模具类型id") + private Long mouldId; + + @Schema(description = "设备id") + private Long equipId; + + @Schema(description = "毛坯结束日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] blankDate; + + @Schema(description = "毛坯负责人") + private String blankOwner; + + @Schema(description = "2D结束日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] twoDimDate; + + @Schema(description = "2D负责人") + private String twoDimOwner; + + @Schema(description = "3D结束日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] threeDimDate; + + @Schema(description = "3D负责人") + private String threeDimOwner; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] 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/plansub/vo/PlanSubRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/vo/PlanSubRespVO.java new file mode 100644 index 00000000..612fb1cf --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/vo/PlanSubRespVO.java @@ -0,0 +1,77 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.plansub.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 生产计划子项目 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PlanSubRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "计划id", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("计划id") + private Long projectPlanId; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("项目id") + private Long projectId; + + @Schema(description = "子项目id") + @ExcelProperty("子项目id") + private Long projectSubId; + + @Schema(description = "子项目简称") + @ExcelProperty("子项目简称") + private String projectSubShortName; + + @Schema(description = "子项目编码") + @ExcelProperty("子项目编码") + private String projectSubCode; + + @Schema(description = "模具类型id") + @ExcelProperty("模具类型id") + private Long mouldId; + + @Schema(description = "设备id") + @ExcelProperty("设备id") + private Long equipId; + + @Schema(description = "毛坯结束日期") + @ExcelProperty("毛坯结束日期") + private LocalDateTime blankDate; + + @Schema(description = "毛坯负责人") + @ExcelProperty("毛坯负责人") + private Long blankOwner; + + @Schema(description = "2D结束日期") + @ExcelProperty("2D结束日期") + private LocalDateTime twoDimDate; + + @Schema(description = "2D负责人") + @ExcelProperty("2D负责人") + private Long twoDimOwner; + + @Schema(description = "3D结束日期") + @ExcelProperty("3D结束日期") + private LocalDateTime threeDimDate; + + @Schema(description = "3D负责人") + @ExcelProperty("3D负责人") + private Long threeDimOwner; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime 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/plansub/vo/PlanSubSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/vo/PlanSubSaveReqVO.java new file mode 100644 index 00000000..5ae1a8a2 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansub/vo/PlanSubSaveReqVO.java @@ -0,0 +1,58 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.plansub.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 PlanSubSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "计划id", requiredMode = Schema.RequiredMode.REQUIRED) + private Long projectPlanId; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "项目id不能为空") + private Long projectId; + + @Schema(description = "子项目id") + private Long projectSubId; + + @Schema(description = "子项目简称") + private String projectSubShortName; + + @Schema(description = "子项目编号") + private String projectSubCode; + + @Schema(description = "模具类型id") + private Long mouldId; + + @Schema(description = "设备id") + private Long equipId; + + @Schema(description = "毛坯结束日期") + private LocalDateTime blankDate; + + @Schema(description = "毛坯负责人") + private String blankOwner; + + @Schema(description = "2D结束日期") + private LocalDateTime twoDimDate; + + @Schema(description = "2D负责人") + private String twoDimOwner; + + @Schema(description = "3D结束日期") + private LocalDateTime threeDimDate; + + @Schema(description = "3D负责人") + private String threeDimOwner; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/ProcessBomController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/ProcessBomController.java new file mode 100644 index 00000000..c81537b9 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/ProcessBomController.java @@ -0,0 +1,136 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.processbom; + +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +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.util.object.BeanUtils; +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum; +import com.chanko.yunxi.mes.framework.operatelog.core.service.OperateLogFrameworkService; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomRespVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO; +import com.chanko.yunxi.mes.module.heli.enums.BusinesTypeEnum; +import com.chanko.yunxi.mes.module.heli.service.processbom.ProcessBomService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.List; + +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 工艺bom") +@RestController +@RequestMapping("/heli/process-bom") +@Validated +public class ProcessBomController { + + @Resource + private ProcessBomService processBomService; + + @Resource + private OperateLogFrameworkService operateLogFrameworkService; + + @Resource + private HttpServletRequest request; + + @PostMapping("/create") + @Operation(summary = "创建工艺bom") + @PreAuthorize("@ss.hasPermission('heli:process-bom:create')") + public CommonResult createProcessBom(@Valid @RequestBody ProcessBomSaveReqVO createReqVO) { + return success(processBomService.createProcessBom(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新工艺bom") + @PreAuthorize("@ss.hasPermission('heli:process-bom:update')") + public CommonResult updateProcessBom(@Valid @RequestBody ProcessBomSaveReqVO updateReqVO) { + processBomService.updateProcessBom(updateReqVO); + return success(true); + } + + @PostMapping("/operate") + @Operation(summary = "操作工艺bom") + @PreAuthorize("@ss.hasPermission('heli:process-bom:update')") + @OperateLog(enable = false) + @Transactional(rollbackFor = Exception.class) + public CommonResult operateProcessBom(@Valid @RequestBody ProcessBomSaveReqVO operateReqVO) { + LocalDateTime startTime = LocalDateTime.now(); + processBomService.operateProcessBom(operateReqVO); + + // 手动记录日志 + operateLogFrameworkService.createOperateLog(request, + startTime, + BusinesTypeEnum.PROCESS_BOM.name(), + operateReqVO.getId(), + OperateTypeEnum.valueOf(operateReqVO.getActive()).getType(), + operateReqVO.getActiveOpinion()); + + return success(operateReqVO.getId()); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除工艺bom") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:process-bom:delete')") + public CommonResult deleteProcessBom(@RequestParam("id") Long id) { + processBomService.deleteProcessBom(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得工艺bom") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:process-bom:query')") + public CommonResult getProcessBom(@RequestParam("id") Long id) { + ProcessBomDO processBom = processBomService.getProcessBom(id); + return success(BeanUtils.toBean(processBom, ProcessBomRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得工艺bom分页") + @PreAuthorize("@ss.hasPermission('heli:process-bom:query')") + public CommonResult> getProcessBomPage(@Valid ProcessBomPageReqVO pageReqVO) { + PageResult pageResult = processBomService.getProcessBomPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ProcessBomRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出工艺bom Excel") + @PreAuthorize("@ss.hasPermission('heli:process-bom:export')") + @OperateLog(type = EXPORT) + public void exportProcessBomExcel(@Valid ProcessBomPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = processBomService.getProcessBomPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "工艺bom.xls", "数据", ProcessBomRespVO.class, + BeanUtils.toBean(list, ProcessBomRespVO.class)); + } + + // ==================== 子表(工艺bom明细) ==================== + + @GetMapping("/process-bom-detail/list-by-bom-id") + @Operation(summary = "获得工艺bom明细列表") + @Parameter(name = "bomId", description = "bom id") + @PreAuthorize("@ss.hasPermission('heli:process-bom:query')") + public CommonResult> getProcessBomDetailListByBomId(@RequestParam("bomId") Long bomId) { + return success(processBomService.getProcessBomDetailListByBomId(bomId)); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomPageReqVO.java new file mode 100644 index 00000000..de254754 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomPageReqVO.java @@ -0,0 +1,64 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +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_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 工艺bom分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ProcessBomPageReqVO extends PageParam { + + @Schema(description = "编号,唯一") + private String code; + + @Schema(description = "生产计划id", example = "19403") + private Long planId; + + @Schema(description = "项目id", example = "32751") + private Long projectId; + + @Schema(description = "子项目id", example = "12526") + private Long projectSubId; + + @Schema(description = "子项目名称", example = "张三") + private String projectSubName; + + @Schema(description = "子项目编号") + private String projectSubCode; + + @Schema(description = "bom版本号") + private Integer version; + + @Schema(description = "bom状态 已保存|已提交 1|2", example = "2") + private Integer bomStatus; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "状态,1表示正常,2表示禁用", example = "2") + private Integer status; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "生产计划单号") + private String planCode; + + @Schema(description = "项目编号") + private String projectCode; + + @Schema(description = "客户名称") + private String customerName; + + @Schema(description = "项目名称") + private String projectName; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomRespVO.java new file mode 100644 index 00000000..7dec5645 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomRespVO.java @@ -0,0 +1,79 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat; +import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 工艺bom Response VO") +@Data +@ExcelIgnoreUnannotated +public class ProcessBomRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "18511") + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "编号,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("编号,唯一") + private String code; + + @Schema(description = "生产计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19403") + @ExcelProperty("生产计划id") + private Long planId; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32751") + @ExcelProperty("项目id") + private Long projectId; + + @Schema(description = "子项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12526") + @ExcelProperty("子项目id") + private Long projectSubId; + + @Schema(description = "子项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @ExcelProperty("子项目名称") + private String projectSubName; + + @Schema(description = "子项目编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("子项目编号") + private String projectSubCode; + + @Schema(description = "bom版本号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("bom版本号") + private Integer version; + + @Schema(description = "bom状态 已保存|已提交 1|2", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty(value = "bom状态 已保存|已提交 1|2", converter = DictConvert.class) + @DictFormat("heli_bom_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer bomStatus; + + @Schema(description = "备注", example = "你猜") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty("状态,1表示正常,2表示禁用") + private Integer status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "计划单号") + private String planCode; + + @Schema(description = "项目编号") + private String projectCode; + + @Schema(description = "客户名称") + private String customerName; + + @Schema(description = "项目名称") + private String projectName; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomSaveReqVO.java new file mode 100644 index 00000000..ff088a15 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processbom/vo/ProcessBomSaveReqVO.java @@ -0,0 +1,63 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO; + +@Schema(description = "管理后台 - 工艺bom新增/修改 Request VO") +@Data +public class ProcessBomSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "18511") + private Long id; + + @Schema(description = "编号") + private String code; + + @Schema(description = "生产计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19403") + @NotNull(message = "生产计划id不能为空") + private Long planId; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32751") + @NotNull(message = "项目id不能为空") + private Long projectId; + + @Schema(description = "子项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12526") + @NotNull(message = "子项目id不能为空") + private Long projectSubId; + + @Schema(description = "子项目名称", example = "张三") + private String projectSubName; + + @Schema(description = "子项目编号") + private String projectSubCode; + + @Schema(description = "bom版本号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "bom版本号不能为空") + private Integer version; + + @Schema(description = "bom状态 已保存|已提交 1|2", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "bom状态 已保存|已提交 1|2不能为空") + private Integer bomStatus; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "状态,1表示正常,2表示禁用不能为空") + private Integer status; + + @Schema(description = "工艺bom明细列表") + private List processBomDetails; + + @Schema(description = "操作类型") + @NotBlank(message = "操作类型不能为空") + private String active; + + @Schema(description = "操作意见") + private String activeOpinion; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/ProcessDesignController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/ProcessDesignController.java index 4db88681..3201283b 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/ProcessDesignController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/ProcessDesignController.java @@ -1,106 +1,113 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.processdesign; - -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.processdesign.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; -import com.chanko.yunxi.mes.module.heli.service.processdesign.ProcessDesignService; - -@Tag(name = "管理后台 - 工艺设计") -@RestController -@RequestMapping("/heli/process-design") -@Validated -public class ProcessDesignController { - - @Resource - private ProcessDesignService processDesignService; - - @PostMapping("/create") - @Operation(summary = "创建工艺设计") - @PreAuthorize("@ss.hasPermission('heli:process-design:create')") - public CommonResult createProcessDesign(@Valid @RequestBody ProcessDesignSaveReqVO createReqVO) { - return success(processDesignService.createProcessDesign(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新工艺设计") - @PreAuthorize("@ss.hasPermission('heli:process-design:update')") - public CommonResult updateProcessDesign(@Valid @RequestBody ProcessDesignSaveReqVO updateReqVO) { - processDesignService.updateProcessDesign(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除工艺设计") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:process-design:delete')") - public CommonResult deleteProcessDesign(@RequestParam("id") Long id) { - processDesignService.deleteProcessDesign(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得工艺设计") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:process-design:query')") - public CommonResult getProcessDesign(@RequestParam("id") Long id) { - ProcessDesignDO processDesign = processDesignService.getProcessDesign(id); - return success(BeanUtils.toBean(processDesign, ProcessDesignRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得工艺设计分页") - @PreAuthorize("@ss.hasPermission('heli:process-design:query')") - public CommonResult> getProcessDesignPage(@Valid ProcessDesignPageReqVO pageReqVO) { - PageResult pageResult = processDesignService.getProcessDesignPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, ProcessDesignRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出工艺设计 Excel") - @PreAuthorize("@ss.hasPermission('heli:process-design:export')") - @OperateLog(type = EXPORT) - public void exportProcessDesignExcel(@Valid ProcessDesignPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = processDesignService.getProcessDesignPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "工艺设计.xls", "数据", ProcessDesignRespVO.class, - BeanUtils.toBean(list, ProcessDesignRespVO.class)); - } - - // ==================== 子表(工艺设计进度) ==================== - - @GetMapping("/process-design-progress/list-by-process-design-id") - @Operation(summary = "获得工艺设计进度列表") - @Parameter(name = "processDesignId", description = "工艺设计id") - @PreAuthorize("@ss.hasPermission('heli:process-design:query')") - public CommonResult> getProcessDesignProgressListByProcessDesignId(@RequestParam("processDesignId") Long processDesignId) { - return success(processDesignService.getProcessDesignProgressListByProcessDesignId(processDesignId)); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.processdesign; + +import com.chanko.yunxi.mes.module.heli.vo.WarningMessageVO; +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.processdesign.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; +import com.chanko.yunxi.mes.module.heli.service.processdesign.ProcessDesignService; + +@Tag(name = "管理后台 - 工艺设计") +@RestController +@RequestMapping("/heli/process-design") +@Validated +public class ProcessDesignController { + + @Resource + private ProcessDesignService processDesignService; + + @PostMapping("/create") + @Operation(summary = "创建工艺设计") + @PreAuthorize("@ss.hasPermission('heli:process-design:create')") + public CommonResult createProcessDesign(@Valid @RequestBody ProcessDesignSaveReqVO createReqVO) { + return success(processDesignService.createProcessDesign(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新工艺设计") + @PreAuthorize("@ss.hasPermission('heli:process-design:update')") + public CommonResult updateProcessDesign(@Valid @RequestBody ProcessDesignSaveReqVO updateReqVO) { + return success(processDesignService.updateProcessDesign(updateReqVO)); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除工艺设计") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:process-design:delete')") + public CommonResult deleteProcessDesign(@RequestParam("id") Long id) { + processDesignService.deleteProcessDesign(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得工艺设计") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:process-design:query')") + public CommonResult getProcessDesign(@RequestParam("id") Long id) { + ProcessDesignDO processDesign = processDesignService.getProcessDesign(id); + return success(BeanUtils.toBean(processDesign, ProcessDesignRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得工艺设计分页") + @PreAuthorize("@ss.hasPermission('heli:process-design:query')") + public CommonResult> getProcessDesignPage(@Valid ProcessDesignPageReqVO pageReqVO) { + PageResult pageResult = processDesignService.getProcessDesignPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ProcessDesignRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出工艺设计 Excel") + @PreAuthorize("@ss.hasPermission('heli:process-design:export')") + @OperateLog(type = EXPORT) + public void exportProcessDesignExcel(@Valid ProcessDesignPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = processDesignService.getProcessDesignPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "工艺设计.xls", "数据", ProcessDesignRespVO.class, + BeanUtils.toBean(list, ProcessDesignRespVO.class)); + } + + // ==================== 子表(工艺设计进度) ==================== + + @GetMapping("/process-design-progress/list-by-process-design-id") + @Operation(summary = "获得工艺设计进度列表") + @Parameter(name = "processDesignId", description = "工艺设计id") + @PreAuthorize("@ss.hasPermission('heli:process-design:query')") + public CommonResult> getProcessDesignProgressListByProcessDesignId(@RequestParam("processDesignId") Long processDesignId) { + return success(processDesignService.getProcessDesignProgressListByProcessDesignId(processDesignId)); + } + + @GetMapping("/warnings") + @Operation(summary = "获得工艺设计预警信息") + @PreAuthorize("@ss.hasPermission('heli:process-design:query')") + public CommonResult getWarnings() { + return success(processDesignService.getWarnings()); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignPageReqVO.java index 3e78bfa6..a0409499 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignPageReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignPageReqVO.java @@ -1,11 +1,14 @@ package com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo; -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; + import java.time.LocalDateTime; +import java.util.List; import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -18,13 +21,7 @@ public class ProcessDesignPageReqVO extends PageParam { @Schema(description = "生产计划id", example = "87") private Long planId; - @Schema(description = "销售订单id", example = "27757") - private Long saleOrderId; - - @Schema(description = "销售订单子项id", example = "7018") - private Long saleOrderSubId; - - @Schema(description = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 FOUNDRY_TECHNOLOGY_BLUEPRINT|3D_BLUEPRINT|2D_BLUEPRINT|WORKBLANK_BLUEPRINT", example = "1") + @Schema(description = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 BLUEPRINT_FOUNDRY_TECHNOLOGY|BLUEPRINT_3D|BLUEPRINT_2D|BLUEPRINT_WORKBLANK", example = "1") private String processDesignType; @Schema(description = "备注", example = "随便") @@ -37,4 +34,58 @@ public class ProcessDesignPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; -} \ No newline at end of file + @Schema(description = "项目id", example = "527") + private Long projectId; + + @Schema(description = "子项目id", example = "28809") + private Long projectSubId; + + @Schema(description = "计划单号") + private String planCode; + + @Schema(description = "项目编号") + private String projectCode; + + @Schema(description = "客户名称") + private String customerName; + + @Schema(description = "项目名称") + private String projectName; + + @Schema(description = "所属业务线") + private Integer businessLine; + + @Schema(description = "性质") + private Integer property; + + @Schema(description = "工艺负责人") + private String craftOwnerName; + + @Schema(description = "3D负责人") + private String threeDimOwnerName; + + @Schema(description = "子项目名称") + private String projectSubName; + + @Schema(description = "2D负责人") + private String twoDimOwnerName; + + @Schema(description = "毛坯负责人") + private String blankOwnerName; + + @Schema(description = "设计类型列表") + private List processDesignTypeList; + + @Schema(description = "是否总览") + private Boolean isOverview = false; + + @Schema(description = "子项目id列表") + private List projectSubIdList; + + @Schema(description = "责任人") + private Long owner; + + @Schema(description = "未完成设计") + private Boolean uncompletedDesign; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignRespVO.java index e2e62ec5..4508ff79 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignRespVO.java @@ -1,12 +1,17 @@ package com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; + +import java.math.BigDecimal; import java.util.*; import java.util.*; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; import com.alibaba.excel.annotation.*; +import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat; +import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert; @Schema(description = "管理后台 - 工艺设计 Response VO") @Data @@ -21,16 +26,9 @@ public class ProcessDesignRespVO { @ExcelProperty("生产计划id") private Long planId; - @Schema(description = "销售订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27757") - @ExcelProperty("销售订单id") - private Long saleOrderId; - - @Schema(description = "销售订单子项id", example = "7018") - @ExcelProperty("销售订单子项id") - private Long saleOrderSubId; - - @Schema(description = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 FOUNDRY_TECHNOLOGY_BLUEPRINT|3D_BLUEPRINT|2D_BLUEPRINT|WORKBLANK_BLUEPRINT", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @ExcelProperty("设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 FOUNDRY_TECHNOLOGY_BLUEPRINT|3D_BLUEPRINT|2D_BLUEPRINT|WORKBLANK_BLUEPRINT") + @Schema(description = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 BLUEPRINT_FOUNDRY_TECHNOLOGY|BLUEPRINT_3D|BLUEPRINT_2D|BLUEPRINT_WORKBLANK", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 BLUEPRINT_FOUNDRY_TECHNOLOGY|BLUEPRINT_3D|BLUEPRINT_2D|BLUEPRINT_WORKBLANK", converter = DictConvert.class) + @DictFormat("heli_process_design_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 private String processDesignType; @Schema(description = "备注", example = "随便") @@ -45,4 +43,84 @@ public class ProcessDesignRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; -} \ No newline at end of file + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "527") + @ExcelProperty("项目id") + private Long projectId; + + @Schema(description = "子项目id") + @ExcelProperty("子项目id") + private Long projectSubId; + + @Schema(description = "计划单号") + private String planCode; + + @Schema(description = "项目编号") + private String projectCode; + + @Schema(description = "客户名称") + private String customerName; + + @Schema(description = "项目名称") + private String projectName; + + @Schema(description = "项目负责人") + private String projectOwnerName; + + @Schema(description = "所属业务线") + private String businessLine; + + @Schema(description = "性质") + private Integer property; + + @Schema(description = "是否紧急") + private Integer isUrgency; + + @Schema(description = "是否需要工艺") + private Integer hasCraft; + + @Schema(description = "工艺负责人") + private String craftOwnerName; + + @Schema(description = "工艺开始日期") + private LocalDateTime craftStartDate; + + @Schema(description = "工艺结束日期") + private LocalDateTime craftEndDate; + + @Schema(description = "毛坯结束日期") + private LocalDateTime blankDate; + + @Schema(description = "毛坯负责人名称") + private String blankOwnerName; + + @Schema(description = "毛坯最新进度") + private BigDecimal progressBlank; + + @Schema(description = "2D结束日期") + private LocalDateTime twoDimDate; + + @Schema(description = "2D负责人名称") + private String twoDimOwnerName; + + @Schema(description = "2D最新进度") + private BigDecimal progress2d; + + @Schema(description = "3D结束日期") + private LocalDateTime threeDimDate; + + @Schema(description = "3D负责人名称") + private String threeDimOwnerName; + + @Schema(description = "3D最新进度") + private BigDecimal progress3d; + + @Schema(description = "子项目名称") + private String projectSubName; + + @Schema(description = "子项目编码") + private String projectSubCode; + + @Schema(description = "最新进度") + private BigDecimal progress; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignSaveReqVO.java index 54d58081..a93c1e85 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/processdesign/vo/ProcessDesignSaveReqVO.java @@ -1,42 +1,42 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; -import java.util.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; - -@Schema(description = "管理后台 - 工艺设计新增/修改 Request VO") -@Data -public class ProcessDesignSaveReqVO { - - @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "13152") - private Long id; - - @Schema(description = "生产计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "87") - @NotNull(message = "生产计划id不能为空") - private Long planId; - - @Schema(description = "销售订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27757") - @NotNull(message = "销售订单id不能为空") - private Long saleOrderId; - - @Schema(description = "销售订单子项id", example = "7018") - private Long saleOrderSubId; - - @Schema(description = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 FOUNDRY_TECHNOLOGY_BLUEPRINT|3D_BLUEPRINT|2D_BLUEPRINT|WORKBLANK_BLUEPRINT", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotEmpty(message = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 FOUNDRY_TECHNOLOGY_BLUEPRINT|3D_BLUEPRINT|2D_BLUEPRINT|WORKBLANK_BLUEPRINT不能为空") - private String processDesignType; - - @Schema(description = "备注", example = "随便") - private String remark; - - @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - @NotNull(message = "状态,1表示正常,2表示禁用不能为空") - private Integer status; - - @Schema(description = "工艺设计进度列表") - private List processDesignProgresss; - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; + +@Schema(description = "管理后台 - 工艺设计新增/修改 Request VO") +@Data +public class ProcessDesignSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "13152") + private Long id; + + @Schema(description = "生产计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "87") + @NotNull(message = "生产计划id不能为空") + private Long planId; + + @Schema(description = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 BLUEPRINT_FOUNDRY_TECHNOLOGY|BLUEPRINT_3D|BLUEPRINT_2D|BLUEPRINT_WORKBLANK", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotEmpty(message = "设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 BLUEPRINT_FOUNDRY_TECHNOLOGY|BLUEPRINT_3D|BLUEPRINT_2D|BLUEPRINT_WORKBLANK不能为空") + private String processDesignType; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "状态,1表示正常,2表示禁用不能为空") + private Integer status; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "527") + @NotNull(message = "项目id不能为空") + private Long projectId; + + @Schema(description = "子项目id", example = "28809") + private Long projectSubId; + + @Schema(description = "工艺设计进度列表") + private List processDesignProgressList; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/projectorder/ProjectOrderController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/projectorder/ProjectOrderController.java index 9af1fd17..4a090cbb 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/projectorder/ProjectOrderController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/projectorder/ProjectOrderController.java @@ -14,6 +14,7 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.projectorder.vo.Project 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.enums.BusinesTypeEnum; +import com.chanko.yunxi.mes.module.heli.manager.CrossOrderManager; import com.chanko.yunxi.mes.module.heli.service.projectorder.ProjectOrderService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -49,6 +50,9 @@ public class ProjectOrderController { @Resource private HttpServletRequest request; + @Resource + private CrossOrderManager crossOrderManager; + @PostMapping("/create") @Operation(summary = "创建项目订单") @PreAuthorize("@ss.hasPermission('heli:project-order:create')") @@ -84,7 +88,13 @@ public class ProjectOrderController { // 批准、终止记录快照 switch (OperateTypeEnum.valueOf(operateReqVO.getActive())){ case APPROVE: + // 订单批准时创建或者更新生产计划数据 + crossOrderManager.generatePlan(operateReqVO.getId()); + projectOrderService.createProjectOrderSnapshot(operateReqVO); + break; case TERMINATE: + // 订单终止时更新生产计划状态 + crossOrderManager.updatePlanStatusToTerminate(operateReqVO.getId()); projectOrderService.createProjectOrderSnapshot(operateReqVO); break; } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/PurchaseOrderController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/PurchaseOrderController.java new file mode 100644 index 00000000..4e878aad --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/PurchaseOrderController.java @@ -0,0 +1,135 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder; + +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanRespVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +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.math.BigDecimal; +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.purchaseorder.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +import com.chanko.yunxi.mes.module.heli.service.purchaseorder.PurchaseOrderService; + +@Tag(name = "管理后台 - 采购订单") +@RestController +@RequestMapping("/heli/purchase-order") +@Validated +public class PurchaseOrderController { + + @Resource + private PurchaseOrderService purchaseOrderService; + + @PostMapping("/create") + @Operation(summary = "创建采购订单") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:create')") + public CommonResult createPurchaseOrder(@Valid @RequestBody PurchaseOrderSaveReqVO createReqVO) { + return success(purchaseOrderService.createPurchaseOrder(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新采购订单") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:update')") + public CommonResult updatePurchaseOrder(@Valid @RequestBody PurchaseOrderSaveReqVO updateReqVO) { + purchaseOrderService.updatePurchaseOrder(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除采购订单") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:purchase-order:delete')") + public CommonResult deletePurchaseOrder(@RequestParam("id") Long id) { + purchaseOrderService.deletePurchaseOrder(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得采购订单") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:query')") + public CommonResult getPurchaseOrder(@RequestParam("id") Long id) { + PurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(id); + return success(BeanUtils.toBean(purchaseOrder, PurchaseOrderRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得采购订单分页") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:query')") + public CommonResult> getPurchaseOrderPage(@Valid PurchaseOrderPageReqVO pageReqVO) { + PageResult pageResult = purchaseOrderService.getPurchaseOrderPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PurchaseOrderRespVO.class)); + } + + @GetMapping("/page-by-status") + @Operation(summary = "获得生产计划分页") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:query')") + public CommonResult> getPurchaseOrderPageByStatus(@Valid PurchaseOrderPageReqVO pageReqVO) { + PageResult pageResult = purchaseOrderService.getPurchaseOrderPageByStatus(pageReqVO); + return success(BeanUtils.toBean(pageResult, PurchaseOrderRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出采购订单 Excel") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:export')") + @OperateLog(type = EXPORT) + public void exportPurchaseOrderExcel(@Valid PurchaseOrderPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = purchaseOrderService.getPurchaseOrderPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "采购订单.xls", "数据", PurchaseOrderRespVO.class, + BeanUtils.toBean(list, PurchaseOrderRespVO.class)); + } + + @GetMapping("/export-excel-with-tax") + @Operation(summary = "导出采购订单 Excel") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:export')") + @OperateLog(type = EXPORT) + public void exportPurchaseOrderExcelWithTax(@Valid PurchaseOrderPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = purchaseOrderService.getPurchaseOrderPageWithTax(pageReqVO).getList(); + + for(PurchaseOrderDO item : list) { + + if(item.getEstimatedPrice() != null && item.getTaxRatio() !=null) { + item.setEstimatedPrice(item.getEstimatedPrice().multiply(BigDecimal.valueOf(item.getTaxRatio())).divide(BigDecimal.valueOf(100))); + }else{ + item.setEstimatedPrice(BigDecimal.ZERO); + } + if(item.getActualPrice() != null && item.getTaxRatio() !=null) { + item.setActualPrice(item.getActualPrice().multiply(BigDecimal.valueOf(item.getTaxRatio())).divide(BigDecimal.valueOf(100))); + }else{ + item.setActualPrice(BigDecimal.ZERO); + } + + } + // 导出 Excel + ExcelUtils.write(response, "采购订单.xls", "数据", PurchaseOrderRespVO.class, + BeanUtils.toBean(list, PurchaseOrderRespVO.class)); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderPageReqVO.java new file mode 100644 index 00000000..28550d9e --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderPageReqVO.java @@ -0,0 +1,87 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.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 PurchaseOrderPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一") + private Long id; + + @Schema(description = "选中采购编号") + private List ids; + + @Schema(description = "采购单号") + private String purchaseNo; + + @Schema(description = "供应商id") + private Long supplierId; + + @Schema(description = "供应商名称") + private String supplierName; + + @Schema(description = "采购合同号") + private String contractNo; + + @Schema(description = "采购单类型,1按物料需求计划采购,2备库采购") + private Integer purchaseType; + + @Schema(description = "供应商id") + private Long projectMaterialPlanId; + + @Schema(description = "供应商id") + private Long materialPlanNo; + + @Schema(description = "采购物类型,1物料,2加工件") + private Integer goodsType; + + @Schema(description = "结算币种") + private Integer currencyType; + + @Schema(description = "税率") + private Integer taxRatio; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + private Integer status; + + @Schema(description = "送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] submitTime; + + @Schema(description = "审核人") + private Long auditor; + + @Schema(description = "审核时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] auditTime; + + @Schema(description = "备注") + private String description; + + @Schema(description = "创建者") + private String creator; + + @Schema(description = "创建时间") + 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/purchaseorder/vo/PurchaseOrderRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderRespVO.java new file mode 100644 index 00000000..23f8fc62 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderRespVO.java @@ -0,0 +1,103 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat; +import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert; +import com.chanko.yunxi.mes.framework.excel.core.convert.TimestampToDateConvert; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 采购订单 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PurchaseOrderRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "采购单号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("采购单号") + private String purchaseNo; + + @Schema(description = "创建时间") + @ExcelProperty(value="单据日期", converter = TimestampToDateConvert.class) + private LocalDateTime createTime; + + @Schema(description = "供应商id") + private Long supplierId; + + @Schema(description = "供应商名称") + @ExcelProperty("供应商") + private String supplierName; + + @Schema(description = "采购单类型,1按物料需求计划采购,2备库采购") + @ExcelProperty(value = "采购单类型", converter = DictConvert.class) + @DictFormat("heli_project_purchase_order_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer purchaseType; + + @Schema(description = "物料需求计划单号") + @ExcelProperty("物料需求计划单号") + private String materialPlanNo; + + @Schema(description = "采购物类型,1物料,2加工件", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty(value = "采购物料类型", converter = DictConvert.class) + @DictFormat("heli_project_purchase_goods_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer goodsType; + + @Schema(description = "采购合同号") + @ExcelProperty("采购合同号") + private String contractNo; + + @Schema(description = "物料需求计划id") + private Long projectMaterialPlanId; + + + @Schema(description = "结算币种") + @ExcelProperty(value ="结算币种",converter = DictConvert.class) + @DictFormat("heli_currency") + private Integer currencyType; + + + @Schema(description = "暂估价金额") + @ExcelProperty("暂估价金额(元)") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + @ExcelProperty("实际价金额(元)") + private BigDecimal actualPrice; + + @Schema(description = "税率") + @ExcelProperty("税率(%)") + private Integer taxRatio; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + @ExcelProperty(value = "单据状态", converter = DictConvert.class) + @DictFormat("heli_purchase_order_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer status; + + @Schema(description = "送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + private LocalDateTime submitTime; + + @Schema(description = "审核人") + private Long auditor; + + @Schema(description = "审核时间") + private LocalDateTime auditTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String description; + + @Schema(description = "创建者") + private String creator; + + + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderSaveReqVO.java new file mode 100644 index 00000000..e576dd3a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderSaveReqVO.java @@ -0,0 +1,68 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.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 PurchaseOrderSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "采购单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String purchaseNo; + + @Schema(description = "供应商id") + private Long supplierId; + + @Schema(description = "采购合同号") + private String contractNo; + + @Schema(description = "采购单类型,1按物料需求计划采购,2备库采购") + private Integer purchaseType; + + @Schema(description = "供应商id") + private Long projectMaterialPlanId; + + @Schema(description = "采购物类型,1物料,2加工件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购物类型,1物料,2加工件不能为空") + private Integer goodsType; + + @Schema(description = "结算币种") + private Integer currencyType; + + @Schema(description = "税率") + private Integer taxRatio; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + private Integer status; + + @Schema(description = "送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + private LocalDateTime submitTime; + + @Schema(description = "审核人") + private Long auditor; + + @Schema(description = "审核时间") + private LocalDateTime auditTime; + + @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/purchaseordermaterial/PurchaseOrderMaterialController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/PurchaseOrderMaterialController.java new file mode 100644 index 00000000..c942b26a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/PurchaseOrderMaterialController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial; + +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.purchaseordermaterial.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +import com.chanko.yunxi.mes.module.heli.service.purchaseordermaterial.PurchaseOrderMaterialService; + +@Tag(name = "管理后台 - 采购单物料") +@RestController +@RequestMapping("/heli/purchase-order-material") +@Validated +public class PurchaseOrderMaterialController { + + @Resource + private PurchaseOrderMaterialService purchaseOrderMaterialService; + + @PostMapping("/create") + @Operation(summary = "创建采购单物料") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:create')") + public CommonResult createPurchaseOrderMaterial(@Valid @RequestBody PurchaseOrderMaterialSaveReqVO createReqVO) { + return success(purchaseOrderMaterialService.createPurchaseOrderMaterial(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新采购单物料") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:update')") + public CommonResult updatePurchaseOrderMaterial(@Valid @RequestBody PurchaseOrderMaterialSaveReqVO updateReqVO) { + purchaseOrderMaterialService.updatePurchaseOrderMaterial(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除采购单物料") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:delete')") + public CommonResult deletePurchaseOrderMaterial(@RequestParam("id") Long id) { + purchaseOrderMaterialService.deletePurchaseOrderMaterial(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得采购单物料") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:query')") + public CommonResult getPurchaseOrderMaterial(@RequestParam("id") Long id) { + PurchaseOrderMaterialDO purchaseOrderMaterial = purchaseOrderMaterialService.getPurchaseOrderMaterial(id); + return success(BeanUtils.toBean(purchaseOrderMaterial, PurchaseOrderMaterialRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得采购单物料分页") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:query')") + public CommonResult> getPurchaseOrderMaterialPage(@Valid PurchaseOrderMaterialPageReqVO pageReqVO) { + PageResult pageResult = purchaseOrderMaterialService.getPurchaseOrderMaterialPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PurchaseOrderMaterialRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出采购单物料 Excel") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:export')") + @OperateLog(type = EXPORT) + public void exportPurchaseOrderMaterialExcel(@Valid PurchaseOrderMaterialPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = purchaseOrderMaterialService.getPurchaseOrderMaterialPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "采购单物料.xls", "数据", PurchaseOrderMaterialRespVO.class, + BeanUtils.toBean(list, PurchaseOrderMaterialRespVO.class)); + } + +} \ 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/purchaseordermaterial/vo/PurchaseOrderMaterialPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialPageReqVO.java new file mode 100644 index 00000000..f0ff45d2 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialPageReqVO.java @@ -0,0 +1,45 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.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 PurchaseOrderMaterialPageReqVO extends PageParam { + + @Schema(description = "采购单编号") + private Long purchaseOrderId; + + @Schema(description = "物料id") + private Long materialId; + + @Schema(description = "采购数量") + private BigDecimal purchaseAmount; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "预计到期日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] arriveTime; + + @Schema(description = "备注") + private String description; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] 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/purchaseordermaterial/vo/PurchaseOrderMaterialRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialRespVO.java new file mode 100644 index 00000000..d04b44d5 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialRespVO.java @@ -0,0 +1,78 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.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 PurchaseOrderMaterialRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("采购单编号") + private Long purchaseOrderId; + + @Schema(description = "物料id") + @ExcelProperty("物料id") + private Long materialId; + + @Schema(description = "采购数量") + @ExcelProperty("采购数量") + private BigDecimal purchaseAmount; + + @Schema(description = "暂估价金额") + @ExcelProperty("暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + @ExcelProperty("实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "预计到期日期") + @ExcelProperty("预计到期日期") + private LocalDateTime arriveTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String description; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "物料id", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("物料id") + private Long matId; + + @Schema(description = "备注") + @ExcelProperty("物料名称") + private String matName; + + @Schema(description = "备注") + @ExcelProperty("物料编码") + private String matCode; + + @Schema(description = "备注") + @ExcelProperty("物料规格型号") + private String matSpec; + + @Schema(description = "备注") + @ExcelProperty("物料单位") + private String matUnit; + + @Schema(description = "备注") + @ExcelProperty("物料类型") + private String matType; + +} \ 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/purchaseordermaterial/vo/PurchaseOrderMaterialSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialSaveReqVO.java new file mode 100644 index 00000000..fb53aa3c --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialSaveReqVO.java @@ -0,0 +1,41 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.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 PurchaseOrderMaterialSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购单编号不能为空") + private Long purchaseOrderId; + + @Schema(description = "物料id") + private Long materialId; + + @Schema(description = "采购数量") + private BigDecimal purchaseAmount; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "预计到期日期") + private LocalDateTime arriveTime; + + @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/supplier/SupplierController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/supplier/SupplierController.java index 7d1fb9f6..c40d6d5f 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/supplier/SupplierController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/supplier/SupplierController.java @@ -1,95 +1,109 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.supplier; - -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.supplier.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; -import com.chanko.yunxi.mes.module.heli.service.supplier.SupplierService; - -@Tag(name = "管理后台 - 供应商") -@RestController -@RequestMapping("/heli/supplier") -@Validated -public class SupplierController { - - @Resource - private SupplierService supplierService; - - @PostMapping("/create") - @Operation(summary = "创建供应商") - @PreAuthorize("@ss.hasPermission('heli:supplier:create')") - public CommonResult createSupplier(@Valid @RequestBody SupplierSaveReqVO createReqVO) { - return success(supplierService.createSupplier(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新供应商") - @PreAuthorize("@ss.hasPermission('heli:supplier:update')") - public CommonResult updateSupplier(@Valid @RequestBody SupplierSaveReqVO updateReqVO) { - supplierService.updateSupplier(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除供应商") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:supplier:delete')") - public CommonResult deleteSupplier(@RequestParam("id") Long id) { - supplierService.deleteSupplier(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得供应商") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:supplier:query')") - public CommonResult getSupplier(@RequestParam("id") Long id) { - SupplierDO supplier = supplierService.getSupplier(id); - return success(BeanUtils.toBean(supplier, SupplierRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得供应商分页") - @PreAuthorize("@ss.hasPermission('heli:supplier:query')") - public CommonResult> getSupplierPage(@Valid SupplierPageReqVO pageReqVO) { - PageResult pageResult = supplierService.getSupplierPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, SupplierRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出供应商 Excel") - @PreAuthorize("@ss.hasPermission('heli:supplier:export')") - @OperateLog(type = EXPORT) - public void exportSupplierExcel(@Valid SupplierPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = supplierService.getSupplierPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "供应商.xls", "数据", SupplierRespVO.class, - BeanUtils.toBean(list, SupplierRespVO.class)); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.supplier; + +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.supplier.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; +import com.chanko.yunxi.mes.module.heli.service.supplier.SupplierService; + +@Tag(name = "管理后台 - 供应商") +@RestController +@RequestMapping("/heli/supplier") +@Validated +public class SupplierController { + + @Resource + private SupplierService supplierService; + + @PostMapping("/create") + @Operation(summary = "创建供应商") + @PreAuthorize("@ss.hasPermission('heli:supplier:create')") + public CommonResult createSupplier(@Valid @RequestBody SupplierSaveReqVO createReqVO) { + return success(supplierService.createSupplier(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新供应商") + @PreAuthorize("@ss.hasPermission('heli:supplier:update')") + public CommonResult updateSupplier(@Valid @RequestBody SupplierSaveReqVO updateReqVO) { + supplierService.updateSupplier(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除供应商") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:supplier:delete')") + public CommonResult deleteSupplier(@RequestParam("id") Long id) { + supplierService.deleteSupplier(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得供应商") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:supplier:query')") + public CommonResult getSupplier(@RequestParam("id") Long id) { + SupplierDO supplier = supplierService.getSupplier(id); + return success(BeanUtils.toBean(supplier, SupplierRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得供应商分页") + @PreAuthorize("@ss.hasPermission('heli:supplier:query')") + public CommonResult> getSupplierPage(@Valid SupplierPageReqVO pageReqVO) { + PageResult pageResult = supplierService.getSupplierPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SupplierRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出供应商 Excel") + @PreAuthorize("@ss.hasPermission('heli:supplier:export')") + @OperateLog(type = EXPORT) + public void exportSupplierExcel(@Valid SupplierPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = supplierService.getSupplierPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "供应商.xls", "数据", SupplierRespVO.class, + BeanUtils.toBean(list, SupplierRespVO.class)); + } + + @GetMapping({"/all-simples"}) + @Operation(summary = "TODO:获取供应商精简信息列表", description = "只包含被开启的供应商,主要用于前端的下拉选项") + public CommonResult> > getSimpleList() { + List> list = supplierService.getSimpleList(); + // 拼接数据 + return success(list); + } + @GetMapping({"/all-no-status-simples"}) + @Operation(summary = "TODO:获取供应商精简信息列表", description = "全部供应商,主要用于前端的下拉选项") + public CommonResult> > getSimpleNoStatusList() { + List> list = supplierService.getSimpleNoStatusList(); + // 拼接数据 + return success(list); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/TaskDispatchController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/TaskDispatchController.java new file mode 100644 index 00000000..42eb73c6 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/TaskDispatchController.java @@ -0,0 +1,106 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch; + +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.taskdispatch.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatchdetail.TaskDispatchDetailDO; +import com.chanko.yunxi.mes.module.heli.service.taskdispatch.TaskDispatchService; + +@Tag(name = "管理后台 - 派工单") +@RestController +@RequestMapping("/heli/task-dispatch") +@Validated +public class TaskDispatchController { + + @Resource + private TaskDispatchService taskDispatchService; + + @PostMapping("/create") + @Operation(summary = "创建派工单") + @PreAuthorize("@ss.hasPermission('heli:task-dispatch:create')") + public CommonResult createTaskDispatch(@Valid @RequestBody TaskDispatchSaveReqVO createReqVO) { + return success(taskDispatchService.createTaskDispatch(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新派工单") + @PreAuthorize("@ss.hasPermission('heli:task-dispatch:update')") + public CommonResult updateTaskDispatch(@Valid @RequestBody TaskDispatchSaveReqVO updateReqVO) { + taskDispatchService.updateTaskDispatch(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除派工单") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:task-dispatch:delete')") + public CommonResult deleteTaskDispatch(@RequestParam("id") Long id) { + taskDispatchService.deleteTaskDispatch(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得派工单") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:task-dispatch:query')") + public CommonResult getTaskDispatch(@RequestParam("id") Long id) { + TaskDispatchDO taskDispatch = taskDispatchService.getTaskDispatch(id); + return success(BeanUtils.toBean(taskDispatch, TaskDispatchRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得派工单分页") + @PreAuthorize("@ss.hasPermission('heli:task-dispatch:query')") + public CommonResult> getTaskDispatchPage(@Valid TaskDispatchPageReqVO pageReqVO) { + PageResult pageResult = taskDispatchService.getTaskDispatchPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, TaskDispatchRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出派工单 Excel") + @PreAuthorize("@ss.hasPermission('heli:task-dispatch:export')") + @OperateLog(type = EXPORT) + public void exportTaskDispatchExcel(@Valid TaskDispatchPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = taskDispatchService.getTaskDispatchPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "派工单.xls", "数据", TaskDispatchRespVO.class, + BeanUtils.toBean(list, TaskDispatchRespVO.class)); + } + + // ==================== 子表(派工明细) ==================== + + @GetMapping("/task-dispatch-detail/list-by-dispatch-id") + @Operation(summary = "获得派工明细列表") + @Parameter(name = "dispatchId", description = "派工单id") + @PreAuthorize("@ss.hasPermission('heli:task-dispatch:query')") + public CommonResult> getTaskDispatchDetailListByDispatchId(@RequestParam("dispatchId") Long dispatchId) { + return success(taskDispatchService.getTaskDispatchDetailListByDispatchId(dispatchId)); + } + +} \ 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/taskdispatch/vo/TaskDispatchPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/vo/TaskDispatchPageReqVO.java new file mode 100644 index 00000000..b2a088f0 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/vo/TaskDispatchPageReqVO.java @@ -0,0 +1,52 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +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_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 派工单分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class TaskDispatchPageReqVO extends PageParam { + + @Schema(description = "编号,唯一") + private String code; + + @Schema(description = "派工类型 生产任务|装配任务 PRODUCTION|ASSEMBLE", example = "1") + private String dispatchType; + + @Schema(description = "生产任务id", example = "8538") + private Long taskId; + + @Schema(description = "生产计划id", example = "3259") + private Long planId; + + @Schema(description = "项目id", example = "19610") + private Long projectId; + + @Schema(description = "子项目id", example = "21985") + private Long projectSubId; + + @Schema(description = "bom明细id", example = "15969") + private Long bomDetailId; + + @Schema(description = "派工状态 已保存|已提交|已终止 1|2|3", example = "2") + private Integer dispatchStatus; + + @Schema(description = "备注", example = "你说的对") + private String remark; + + @Schema(description = "状态,1表示正常,2表示禁用", example = "1") + private Integer status; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] 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/taskdispatch/vo/TaskDispatchRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/vo/TaskDispatchRespVO.java new file mode 100644 index 00000000..f0321c90 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/vo/TaskDispatchRespVO.java @@ -0,0 +1,68 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat; +import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 派工单 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TaskDispatchRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "26723") + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "编号,唯一") + @ExcelProperty("编号,唯一") + private String code; + + @Schema(description = "派工类型 生产任务|装配任务 PRODUCTION|ASSEMBLE", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "派工类型 生产任务|装配任务 PRODUCTION|ASSEMBLE", converter = DictConvert.class) + @DictFormat("heli_dispatch_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private String dispatchType; + + @Schema(description = "生产任务id", example = "8538") + @ExcelProperty("生产任务id") + private Long taskId; + + @Schema(description = "生产计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3259") + @ExcelProperty("生产计划id") + private Long planId; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19610") + @ExcelProperty("项目id") + private Long projectId; + + @Schema(description = "子项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21985") + @ExcelProperty("子项目id") + private Long projectSubId; + + @Schema(description = "bom明细id", example = "15969") + @ExcelProperty("bom明细id") + private Long bomDetailId; + + @Schema(description = "派工状态 已保存|已提交|已终止 1|2|3", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty(value = "派工状态 已保存|已提交|已终止 1|2|3", converter = DictConvert.class) + @DictFormat("heli_dispatch_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer dispatchStatus; + + @Schema(description = "备注", example = "你说的对") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("状态,1表示正常,2表示禁用") + private Integer status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime 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/taskdispatch/vo/TaskDispatchSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/vo/TaskDispatchSaveReqVO.java new file mode 100644 index 00000000..2b1f773e --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/taskdispatch/vo/TaskDispatchSaveReqVO.java @@ -0,0 +1,56 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatchdetail.TaskDispatchDetailDO; + +@Schema(description = "管理后台 - 派工单新增/修改 Request VO") +@Data +public class TaskDispatchSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "26723") + private Long id; + + @Schema(description = "编号,唯一") + private String code; + + @Schema(description = "派工类型 生产任务|装配任务 PRODUCTION|ASSEMBLE", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotEmpty(message = "派工类型 生产任务|装配任务 PRODUCTION|ASSEMBLE不能为空") + private String dispatchType; + + @Schema(description = "生产任务id", example = "8538") + private Long taskId; + + @Schema(description = "生产计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3259") + @NotNull(message = "生产计划id不能为空") + private Long planId; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19610") + @NotNull(message = "项目id不能为空") + private Long projectId; + + @Schema(description = "子项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21985") + @NotNull(message = "子项目id不能为空") + private Long projectSubId; + + @Schema(description = "bom明细id", example = "15969") + private Long bomDetailId; + + @Schema(description = "派工状态 已保存|已提交|已终止 1|2|3", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "派工状态 已保存|已提交|已终止 1|2|3不能为空") + private Integer dispatchStatus; + + @Schema(description = "备注", example = "你说的对") + private String remark; + + @Schema(description = "状态,1表示正常,2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态,1表示正常,2表示禁用不能为空") + private Integer status; + + @Schema(description = "派工明细列表") + private List taskDispatchDetails; + +} \ 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/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 new file mode 100644 index 00000000..30bef219 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/materialplan/MaterialPlanDO.java @@ -0,0 +1,87 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 物料需求计划 DO + * + * @author 管理员 + */ +@TableName("project_material_plan") +@KeySequence("project_material_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MaterialPlanDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 物料计划单号 + */ + private String projectMaterialPlanNo; + + /** + * 订单id + */ + private Long projectId; + /** + * 生产计划id + */ + private Long projectPlanId; + /** + * 送审人 + */ + private Long submitUserId; + /** + * 送审时间 + */ + private LocalDateTime submitTime; + /** + * 审核人 + */ + private Long auditor; + /** + * 审核时间 + */ + private LocalDateTime auditTime; + /** + * 状态,1已保存,2已送审,3已审核,4已打回 ,默认是1 + * + * 枚举 {@link TODO heli_project_material_plan_status 对应的类} + */ + private Integer status; + /** + * 备注 + */ + 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/materialplandetail/MaterialPlanDetailDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/materialplandetail/MaterialPlanDetailDO.java new file mode 100644 index 00000000..ec4a9050 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/materialplandetail/MaterialPlanDetailDO.java @@ -0,0 +1,71 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail; + +import lombok.*; + +import java.math.BigDecimal; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 物料需求计划物料详情 DO + * + * @author 管理员 + */ +@TableName("project_material_plan_detail") +@KeySequence("project_material_plan_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MaterialPlanDetailDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 物料需求采购计划id + */ + private Long projectMaterialPlanId; + /** + * 物料id + */ + private Long materialId; + /** + * 子项目编号 + */ + private Long projectSubId; + /** + * 需求数量 + */ + private BigDecimal requireAmount; + /** + * 需求到货日期 + */ + private LocalDateTime requireArriveTime; + /** + * 备注 + */ + private String description; + + @TableField(exist = false) + private Long matId; + @TableField(exist = false) + private String matName; + @TableField(exist = false) + private String matCode; + @TableField(exist = false) + private String matSpec; + @TableField(exist = false) + private String matUnit; + @TableField(exist = false) + private String matType; + +} \ 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/plan/PlanDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plan/PlanDO.java new file mode 100644 index 00000000..0a608460 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plan/PlanDO.java @@ -0,0 +1,141 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.plan; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 生产计划 DO + * + * @author 管理员 + */ +@TableName("project_plan") +@KeySequence("project_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PlanDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 计划单号 + */ + private String planNo; + /** + * 项目id + */ + private Long projectId; + /** + * 项目负责人 + */ + private Long projectOwner; + /** + * 是否需要工艺:1表示需要,0表示不需要 + * + * 枚举 {@link TODO heli_common_is_or_not 对应的类} + */ + private Integer hasCraft; + /** + * 工艺负责人 + */ + private Long craftOwner; + /** + * 工艺开始日期 + */ + private LocalDateTime craftStartDate; + /** + * 工艺结束日期 + */ + private LocalDateTime craftEndDate; + /** + * 工艺流程数组信息[{'id':1,'sdate':'','edate':'','owner':'','description':''}] + */ + private String craftContent; + /** + * 编辑人 + */ + private Long editor; + /** + * 编辑日期 + */ + private LocalDateTime editorDate; + /** + * 审核人 + */ + private Long auditor; + /** + * 审核日期 + */ + private LocalDateTime auditDate; + /** + * 批准人 + */ + private Long approver; + /** + * 批准日期 + */ + private LocalDateTime approveDate; + /** + * 备注 + */ + private String description; + /** + * 状态,1未开始,2生产中,3已完成,4已终止 ,默认是1 + */ + private Integer status; + /** + * 项目变更次数 + */ + private Integer changeNum; + /** + * 项目变更日期 + */ + private LocalDateTime changeLastDate; + + @TableField(exist = false) + private String projectCode; + + @TableField(exist = false) + private String customerName; + + @TableField(exist = false) + private String projectName; + + @TableField(exist = false) + private String businessManName; + + + @TableField(exist = false) + private LocalDateTime projectStartTime; + + @TableField(exist = false) + private LocalDateTime projectEndTime; + + @TableField(exist = false) + private String businessLine; + + @TableField(exist = false) + private Integer property; + + @TableField(exist = false) + private Integer hasAlter; + + @TableField(exist = false) + private Integer isUrgency; + +} \ 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/plansub/PlanSubDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plansub/PlanSubDO.java new file mode 100644 index 00000000..787eef1d --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plansub/PlanSubDO.java @@ -0,0 +1,86 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.plansub; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 生产计划子项目 DO + * + * @author 管理员 + */ +@TableName("project_plan_sub") +@KeySequence("project_plan_sub_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PlanSubDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 计划id + */ + private Long projectPlanId; + /** + * 项目id + */ + private Long projectId; + /** + * 子项目id + */ + private Long projectSubId; + /** + * 模具类型id + */ + private Long mouldId; + /** + * 设备id + */ + private Long equipId; + /** + * 毛坯结束日期 + */ + private LocalDateTime blankDate; + /** + * 毛坯负责人 + */ + private Long blankOwner; + /** + * 2D结束日期 + */ + private LocalDateTime twoDimDate; + /** + * 2D负责人 + */ + private Long twoDimOwner; + /** + * 3D结束日期 + */ + private LocalDateTime threeDimDate; + /** + * 3D负责人 + */ + private Long threeDimOwner; + /** + * 子项目简称 + */ + private String projectSubShortName; + /** + * 子项目编码 + */ + private String projectSubCode; + +} \ 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/processbom/ProcessBomDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processbom/ProcessBomDO.java new file mode 100644 index 00000000..030ba032 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processbom/ProcessBomDO.java @@ -0,0 +1,108 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom; + +import com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum; +import com.chanko.yunxi.mes.module.heli.enums.ProcessBomStatusEnum; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 工艺bom DO + * + * @author 管理员 + */ +@TableName("pro_process_bom") +@KeySequence("pro_process_bom_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProcessBomDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 编号,唯一 + */ + private String code; + /** + * 生产计划id + */ + private Long planId; + /** + * 项目id + */ + private Long projectId; + /** + * 子项目id + */ + private Long projectSubId; + /** + * bom版本号 + */ + private Integer version; + /** + * bom状态 已保存|已提交 1|2 + * + * 枚举 {@link TODO heli_bom_status 对应的类} + */ + private Integer bomStatus; + /** + * 备注 + */ + private String remark; + /** + * 状态,1表示正常,2表示禁用 + */ + private Integer status; + /** + * 子项目名称 + */ + @TableField(exist = false) + private String projectSubName; + + @TableField(exist = false) + private String planCode; + + @TableField(exist = false) + private String projectCode; + + @TableField(exist = false) + private String customerName; + + @TableField(exist = false) + private String projectName; + + public boolean canSave(){ + return ProcessBomStatusEnum.SAVE.getCode() == this.bomStatus.intValue(); + } + + public boolean canSubmit(){ + return ProcessBomStatusEnum.SAVE.getCode() == this.bomStatus.intValue(); + } + + public boolean canCancel(){ + return ProcessBomStatusEnum.SUBMIT.getCode() == this.bomStatus.intValue(); + } + + public boolean canOperate(OperateTypeEnum operateTypeEnum) { + switch (operateTypeEnum){ + case SAVE: + return canSave(); + case SUBMIT: + return canSubmit(); + case CANCEL_SUBMIT: + return canCancel(); + default: + return false; + } + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processbom/ProcessBomDetailDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processbom/ProcessBomDetailDO.java new file mode 100644 index 00000000..ea2e5672 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processbom/ProcessBomDetailDO.java @@ -0,0 +1,80 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom; + +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; +import lombok.*; + +/** + * 工艺bom明细 DO + * + * @author 管理员 + */ +@TableName("pro_process_bom_detail") +@KeySequence("pro_process_bom_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProcessBomDetailDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * bom id + */ + private Long bomId; + /** + * 零件类型 1 标准件|2 其它 + * + * 枚举 {@link TODO heli_bom_material_type 对应的类} + */ + private String type; + /** + * 物料id + */ + private Long materialId; + /** + * 物料名称 + */ + private String materialName; + /** + * 物料编码 + */ + private String materialCode; + /** + * 材质id + */ + private Long compositionId; + /** + * 规格 + */ + private String spec; + /** + * 单位 + */ + private String unit; + /** + * 图号 + */ + private String blueprintNo; + /** + * 数量 + */ + private Integer amount; + /** + * 备注 + */ + private String remark; + /** + * 状态,1表示正常,2表示禁用 + */ + private Integer status; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processdesign/ProcessDesignDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processdesign/ProcessDesignDO.java index cb8df2d7..cb403820 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processdesign/ProcessDesignDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processdesign/ProcessDesignDO.java @@ -1,6 +1,8 @@ package com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign; import lombok.*; + +import java.math.BigDecimal; import java.util.*; import java.time.LocalDateTime; import java.time.LocalDateTime; @@ -32,15 +34,9 @@ public class ProcessDesignDO extends BaseDO { */ private Long planId; /** - * 销售订单id - */ - private Long saleOrderId; - /** - * 销售订单子项id - */ - private Long saleOrderSubId; - /** - * 设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 FOUNDRY_TECHNOLOGY_BLUEPRINT|3D_BLUEPRINT|2D_BLUEPRINT|WORKBLANK_BLUEPRINT + * 设计类型 铸造工艺|3D图纸|2D图纸|毛坯图纸 BLUEPRINT_FOUNDRY_TECHNOLOGY|BLUEPRINT_3D|BLUEPRINT_2D|BLUEPRINT_WORKBLANK + * + * 枚举 {@link TODO heli_process_design_type 对应的类} */ private String processDesignType; /** @@ -51,5 +47,85 @@ public class ProcessDesignDO extends BaseDO { * 状态,1表示正常,2表示禁用 */ private Integer status; + /** + * 项目id + */ + private Long projectId; + /** + * 子项目id + */ + private Long projectSubId; + + @TableField(exist = false) + private String planCode; + + @TableField(exist = false) + private String projectCode; + + @TableField(exist = false) + private String customerName; + + @TableField(exist = false) + private String projectName; + + @TableField(exist = false) + private String projectOwnerName; + + @TableField(exist = false) + private String businessLine; + + @TableField(exist = false) + private Integer property; + + @TableField(exist = false) + private Integer isUrgency; + + @TableField(exist = false) + private Integer hasCraft; + + @TableField(exist = false) + private String craftOwnerName; + + @TableField(exist = false) + private LocalDateTime craftStartDate; + + @TableField(exist = false) + private LocalDateTime craftEndDate; + + @TableField(exist = false) + private LocalDateTime blankDate; + + @TableField(exist = false) + private String blankOwnerName; + + @TableField(exist = false) + private BigDecimal progressBlank; + + @TableField(exist = false) + private LocalDateTime twoDimDate; + + @TableField(exist = false) + private String twoDimOwnerName; + + @TableField(exist = false) + private BigDecimal progress2d; + + @TableField(exist = false) + private LocalDateTime threeDimDate; + + @TableField(exist = false) + private String threeDimOwnerName; + + @TableField(exist = false) + private BigDecimal progress3d; + + @TableField(exist = false) + private String projectSubName; + + @TableField(exist = false) + private String projectSubCode; + + @TableField(exist = false) + private BigDecimal progress; -} \ 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/processdesign/ProcessDesignProgressDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processdesign/ProcessDesignProgressDO.java index 840090c0..95f0ef8f 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processdesign/ProcessDesignProgressDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/processdesign/ProcessDesignProgressDO.java @@ -49,4 +49,9 @@ public class ProcessDesignProgressDO extends BaseDO { */ private Integer status; -} \ No newline at end of file + private Boolean deleted; + + @TableField(exist = false) + private String creatorName; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/projectorder/ProjectOrderSubDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/projectorder/ProjectOrderSubDO.java index 0f314495..ba4ac689 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/projectorder/ProjectOrderSubDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/projectorder/ProjectOrderSubDO.java @@ -80,4 +80,7 @@ public class ProjectOrderSubDO extends BaseDO { @TableField(exist = false) private String projectOrderCode; + + @TableField(exist = false) + private String deviceName; } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseorder/PurchaseOrderDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseorder/PurchaseOrderDO.java new file mode 100644 index 00000000..d7b4eb78 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseorder/PurchaseOrderDO.java @@ -0,0 +1,110 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 采购订单 DO + * + * @author 管理员 + */ +@TableName("project_purchase_order") +@KeySequence("project_purchase_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PurchaseOrderDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 采购单号 + */ + private String purchaseNo; + /** + * 供应商id + */ + private Long supplierId; + /** + * 采购合同号 + */ + private String contractNo; + /** + * 采购单类型,1按物料需求计划采购,2备库采购 + * + * 枚举 {@link TODO heli_project_purchase_order_type 对应的类} + */ + private Integer purchaseType; + /** + * 供应商id + */ + private Long projectMaterialPlanId; + /** + * 采购物类型,1物料,2加工件 + * + * 枚举 {@link TODO heli_project_purchase_goods_type 对应的类} + */ + private Integer goodsType; + /** + * 结算币种 + */ + private Integer currencyType; + /** + * 税率 + */ + private Integer taxRatio; + /** + * 暂估价金额 + */ + private BigDecimal estimatedPrice; + /** + * 实际价金额 + */ + private BigDecimal actualPrice; + /** + * 状态,1已保存,2已送审,3已审核,4已打回 ,默认是1 + * + * 枚举 {@link TODO heli_purchase_order_status 对应的类} + */ + private Integer status; + /** + * 送审人 + */ + private Long submitUserId; + /** + * 送审时间 + */ + private LocalDateTime submitTime; + /** + * 审核人 + */ + private Long auditor; + /** + * 审核时间 + */ + private LocalDateTime auditTime; + /** + * 备注 + */ + private String description; + + @TableField(exist = false) + private String supplierName; + @TableField(exist = false) + private String materialPlanNo; + +} \ 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/purchaseordermaterial/PurchaseOrderMaterialDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseordermaterial/PurchaseOrderMaterialDO.java new file mode 100644 index 00000000..9b7b6e52 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseordermaterial/PurchaseOrderMaterialDO.java @@ -0,0 +1,75 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 采购单物料 DO + * + * @author 管理员 + */ +@TableName("project_purchase_order_material") +@KeySequence("project_purchase_order_material_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PurchaseOrderMaterialDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 采购单编号 + */ + private Long purchaseOrderId; + /** + * 物料id + */ + private Long materialId; + /** + * 采购数量 + */ + private BigDecimal purchaseAmount; + /** + * 暂估价金额 + */ + private BigDecimal estimatedPrice; + /** + * 实际价金额 + */ + private BigDecimal actualPrice; + /** + * 预计到期日期 + */ + private LocalDateTime arriveTime; + /** + * 备注 + */ + private String description; + + @TableField(exist = false) + private Long matId; + @TableField(exist = false) + private String matName; + @TableField(exist = false) + private String matCode; + @TableField(exist = false) + private String matSpec; + @TableField(exist = false) + private String matUnit; + @TableField(exist = false) + private String matType; + +} \ 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/dataobject/taskdispatch/TaskDispatchDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/taskdispatch/TaskDispatchDO.java new file mode 100644 index 00000000..75cc0ae1 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/taskdispatch/TaskDispatchDO.java @@ -0,0 +1,75 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 派工单 DO + * + * @author 管理员 + */ +@TableName("pro_task_dispatch") +@KeySequence("pro_task_dispatch_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaskDispatchDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 编号,唯一 + */ + private String code; + /** + * 派工类型 生产任务|装配任务 PRODUCTION|ASSEMBLE + * + * 枚举 {@link TODO heli_dispatch_type 对应的类} + */ + private String dispatchType; + /** + * 生产任务id + */ + private Long taskId; + /** + * 生产计划id + */ + private Long planId; + /** + * 项目id + */ + private Long projectId; + /** + * 子项目id + */ + private Long projectSubId; + /** + * bom明细id + */ + private Long bomDetailId; + /** + * 派工状态 已保存|已提交|已终止 1|2|3 + * + * 枚举 {@link TODO heli_dispatch_status 对应的类} + */ + private Integer dispatchStatus; + /** + * 备注 + */ + private String remark; + /** + * 状态,1表示正常,2表示禁用 + */ + private Integer status; + +} \ 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/taskdispatch/TaskDispatchDetailDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/taskdispatch/TaskDispatchDetailDO.java new file mode 100644 index 00000000..3d1bc8bb --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/taskdispatch/TaskDispatchDetailDO.java @@ -0,0 +1,64 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatchdetail; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 派工明细 DO + * + * @author 管理员 + */ +@TableName("pro_task_dispatch_detail") +@KeySequence("pro_task_dispatch_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaskDispatchDetailDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 工序id + */ + private Long procedureId; + /** + * 顺序号 + */ + private Integer sort; + /** + * 负责人 + */ + private Long owner; + /** + * 预计工时 + */ + private BigDecimal workTime; + /** + * 派工数量 + */ + private Integer amount; + /** + * 工序要点 + */ + private String summary; + /** + * 状态,1表示正常,2表示禁用 + */ + private Boolean status; + /** + * 派工单id + */ + private Long dispatchId; + +} \ 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/customer/CustomerMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/customer/CustomerMapper.java index 27f594f8..6c990797 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/customer/CustomerMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/customer/CustomerMapper.java @@ -1,13 +1,12 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.customer; -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.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.CustomerPageReqVO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; import org.apache.ibatis.annotations.Mapper; -import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.*; +import org.springframework.util.StringUtils; /** * 客户新表 Mapper @@ -18,11 +17,16 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.*; public interface CustomerMapper extends BaseMapperX { default PageResult selectPage(CustomerPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() + LambdaQueryWrapperX query = new LambdaQueryWrapperX() .likeIfPresent(CustomerDO::getCode, reqVO.getCode()) .likeIfPresent(CustomerDO::getBrief, reqVO.getBrief()) .eqIfPresent(CustomerDO::getStatus, reqVO.getStatus()) - .orderByDesc(CustomerDO::getId)); + .orderByDesc(CustomerDO::getId); + + if(!StringUtils.isEmpty(reqVO.getBriefOrName())){ + query.and(QueryWrapper -> QueryWrapper.like(CustomerDO::getBrief, reqVO.getBriefOrName()).or().like(CustomerDO::getName, reqVO.getName())); + } + 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/dal/mysql/equip/EquipMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/equip/EquipMapper.java index 46e6c017..65c89596 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/equip/EquipMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/equip/EquipMapper.java @@ -2,10 +2,12 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.equip; import java.util.*; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.dal.dataobject.equip.EquipDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.rg.RgDO; import org.apache.ibatis.annotations.Mapper; import com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo.*; @@ -31,4 +33,11 @@ public interface EquipMapper extends BaseMapperX { .orderByDesc(EquipDO::getId)); } + default List> selectSimpleList() { + return selectMaps(new QueryWrapper().select("id", "name","mould_type_id").eq("status","1").lambda()); + } + + default List> selectNoStatusSimpleList() { + return selectMaps(new QueryWrapper().select("id", "name","mould_type_id").lambda()); + } } \ 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/material/MaterialMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java index 39d182b0..9e7f6548 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java @@ -8,6 +8,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.pn.PnDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; import com.chanko.yunxi.mes.module.heli.enums.YesOrNoEnum; +import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO; import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.apache.ibatis.annotations.Mapper; import org.springframework.util.StringUtils; @@ -35,7 +36,13 @@ public interface MaterialMapper extends BaseMapperX { .eq(!StringUtils.isEmpty(reqVO.getMaterialType()), MaterialDO::getMaterialType, reqVO.getMaterialType()) .eq(reqVO.getStatus() != null, MaterialDO::getStatus, reqVO.getStatus()) .eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.N.name()) - .eq(!StringUtils.isEmpty(reqVO.getVirtualPart()), MaterialDO::getVirtualPart, reqVO.getVirtualPart()); + .apply(!StringUtils.isEmpty(reqVO.getCodeAndName()), " (t.name like {0} or t.code like {0})", "%"+reqVO.getCodeAndName()+"%"); + +// if(!StringUtils.isEmpty(reqVO.getCodeAndName())){ +// query.like(MaterialDO::getName, reqVO.getCodeAndName()).or().like(MaterialDO::getCode, reqVO.getCodeAndName()); +// +// } + return selectPage(reqVO, query); } 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 new file mode 100644 index 00000000..912aa8aa --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/materialplan/MaterialPlanMapper.java @@ -0,0 +1,60 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.materialplan; + +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 + * + * @author 管理员 + */ +@Mapper +public interface MaterialPlanMapper extends BaseMapperX { + + default PageResult selectPage(MaterialPlanPageReqVO reqVO) { + 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 && !reqVO.getCreateTime().equals("Invalid Date"), "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/materialplandetail/MaterialPlanDetailMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/materialplandetail/MaterialPlanDetailMapper.java new file mode 100644 index 00000000..2dced6a3 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/materialplandetail/MaterialPlanDetailMapper.java @@ -0,0 +1,52 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.materialplandetail; + +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.materialplan.vo.MaterialPlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo.*; +import org.springframework.util.StringUtils; + +/** + * 物料需求计划物料详情 Mapper + * + * @author 管理员 + */ +@Mapper +public interface MaterialPlanDetailMapper extends BaseMapperX { + + default PageResult selectPage(MaterialPlanDetailPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(MaterialPlanDetailDO.class) + .select("mat.id as matId","mat.name as matName","mat.code as matCode","mat.spec as matSpec","mat.unit as matUnit","mat.material_type as matType") + .leftJoin(MaterialDO.class, "mat", MaterialDO::getId, MaterialPlanDetailDO::getMaterialId) + .disableSubLogicDel() + .orderByDesc(MaterialPlanDetailDO::getCreateTime); + query.eq(reqVO.getProjectMaterialPlanId()!=null,MaterialPlanDetailDO::getProjectMaterialPlanId, reqVO.getProjectMaterialPlanId()).orderByAsc(MaterialPlanDetailDO::getCreateTime); + + return selectPage(reqVO, query); + } +// default PageResult selectPage(MaterialPlanDetailPageReqVO reqVO) { +// return selectPage(reqVO, new LambdaQueryWrapperX() +// .eqIfPresent(MaterialPlanDetailDO::getId, reqVO.getId()) +// .eqIfPresent(MaterialPlanDetailDO::getProjectMaterialPlanId, reqVO.getProjectMaterialPlanId()) +// .eqIfPresent(MaterialPlanDetailDO::getMaterialId, reqVO.getMaterialId()) +// .eqIfPresent(MaterialPlanDetailDO::getProjectSubId, reqVO.getProjectSubId()) +// .eqIfPresent(MaterialPlanDetailDO::getRequireAmount, reqVO.getRequireAmount()) +// .betweenIfPresent(MaterialPlanDetailDO::getRequireArriveTime, reqVO.getRequireArriveTime()) +// .eqIfPresent(MaterialPlanDetailDO::getDescription, reqVO.getDescription()) +// .betweenIfPresent(MaterialPlanDetailDO::getCreateTime, reqVO.getCreateTime()) +// .orderByDesc(MaterialPlanDetailDO::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/mouldtype/MouldTypeMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/mouldtype/MouldTypeMapper.java index 10155872..0ef06afb 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/mouldtype/MouldTypeMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/mouldtype/MouldTypeMapper.java @@ -27,8 +27,9 @@ public interface MouldTypeMapper extends BaseMapperX { .orderByDesc(MouldTypeDO::getId)); } default List> selectSimpleList() { - return selectMaps(new QueryWrapper().select("id", "name").eq("status","1").lambda()); - + } + default List> selectNoStatusSimpleList() { + return selectMaps(new QueryWrapper().select("id", "name").lambda()); } } \ 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 new file mode 100644 index 00000000..268f2d6f --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plan/PlanMapper.java @@ -0,0 +1,97 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.plan; + +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.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; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.*; +import org.springframework.util.StringUtils; + +/** + * 生产计划 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PlanMapper extends BaseMapperX { + + default PageResult selectPage(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()) + .eq(reqVO.getStatus() != null, PlanDO::getStatus, reqVO.getStatus()); + + 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()) +// .likeIfPresent(PlanDO::getPlanNo, reqVO.getPlanNo()) +// .eqIfPresent(PlanDO::getProjectId, reqVO.getProjectId()) +// .likeIfPresent(PlanDO::getProjectOwner, reqVO.getProjectOwner()) +// .eqIfPresent(PlanDO::getHasCraft, reqVO.getHasCraft()) +// .likeIfPresent(PlanDO::getCraftOwner, reqVO.getCraftOwner()) +// .betweenIfPresent(PlanDO::getCraftStartDate, reqVO.getCraftStartDate()) +// .betweenIfPresent(PlanDO::getCraftEndDate, reqVO.getCraftEndDate()) +// .likeIfPresent(PlanDO::getEditor, reqVO.getEditor()) +// .betweenIfPresent(PlanDO::getEditorDate, reqVO.getEditorDate()) +// .likeIfPresent(PlanDO::getAuditor, reqVO.getAuditor()) +// .betweenIfPresent(PlanDO::getAuditDate, reqVO.getAuditDate()) +// .likeIfPresent(PlanDO::getApprover, reqVO.getApprover()) +// .betweenIfPresent(PlanDO::getApproveDate, reqVO.getApproveDate()) +// .eqIfPresent(PlanDO::getDescription, reqVO.getDescription()) +// .eqIfPresent(PlanDO::getStatus, reqVO.getStatus()) +// .eqIfPresent(PlanDO::getChangeNum, reqVO.getChangeNum()) +// .betweenIfPresent(PlanDO::getCreateTime, reqVO.getCreateTime()) +// .orderByDesc(PlanDO::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/plansub/PlanSubMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plansub/PlanSubMapper.java new file mode 100644 index 00000000..85af0656 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plansub/PlanSubMapper.java @@ -0,0 +1,38 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.plansub; + +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.dal.dataobject.plansub.PlanSubDO; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.plansub.vo.*; + +/** + * 生产计划子项目 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PlanSubMapper extends BaseMapperX { + + default PageResult selectPage(PlanSubPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PlanSubDO::getId, reqVO.getId()) + .eqIfPresent(PlanSubDO::getProjectPlanId, reqVO.getProjectPlanId()) + .eqIfPresent(PlanSubDO::getProjectId, reqVO.getProjectId()) + .eqIfPresent(PlanSubDO::getProjectSubId, reqVO.getProjectSubId()) + .eqIfPresent(PlanSubDO::getMouldId, reqVO.getMouldId()) + .eqIfPresent(PlanSubDO::getEquipId, reqVO.getEquipId()) + .betweenIfPresent(PlanSubDO::getBlankDate, reqVO.getBlankDate()) + .betweenIfPresent(PlanSubDO::getTwoDimDate, reqVO.getTwoDimDate()) + .eqIfPresent(PlanSubDO::getBlankOwner, reqVO.getBlankOwner()) + .eqIfPresent(PlanSubDO::getTwoDimOwner, reqVO.getTwoDimOwner()) + .betweenIfPresent(PlanSubDO::getThreeDimDate, reqVO.getThreeDimDate()) + .eqIfPresent(PlanSubDO::getThreeDimOwner, reqVO.getThreeDimOwner()) + .betweenIfPresent(PlanSubDO::getCreateTime, reqVO.getCreateTime()) + .orderByAsc(PlanSubDO::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/processbom/ProcessBomDetailMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processbom/ProcessBomDetailMapper.java new file mode 100644 index 00000000..9b085521 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processbom/ProcessBomDetailMapper.java @@ -0,0 +1,25 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.processbom; + +import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 工艺bom明细 Mapper + * + * @author 管理员 + */ +@Mapper +public interface ProcessBomDetailMapper extends BaseMapperX { + + default List selectListByBomId(Long bomId) { + return selectList(ProcessBomDetailDO::getBomId, bomId); + } + + default int deleteByBomId(Long bomId) { + return delete(ProcessBomDetailDO::getBomId, bomId); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processbom/ProcessBomMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processbom/ProcessBomMapper.java new file mode 100644 index 00000000..96e8fd2f --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processbom/ProcessBomMapper.java @@ -0,0 +1,70 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.processbom; + +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.controller.admin.processbom.vo.ProcessBomPageReqVO; +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.plansub.PlanSubDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.util.StringUtils; + +/** + * 工艺bom Mapper + * + * @author 管理员 + */ +@Mapper +public interface ProcessBomMapper extends BaseMapperX { + + default PageResult selectPage(ProcessBomPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(ProcessBomDO.class) + .select("concat('BOM-', e.project_sub_code) as code") + .select("a.plan_no as planCode", "b.code as projectCode", "c.name as customerName", "b.project_name as projectName") + .select("d.name as projectSubName") + .leftJoin(PlanDO.class, "a", PlanDO::getId, ProcessBomDO::getPlanId) + .leftJoin(PlanSubDO.class, "e", PlanSubDO::getProjectSubId, ProcessBomDO::getProjectSubId) + .leftJoin(ProjectOrderDO.class, "b", ProjectOrderDO::getId, ProcessBomDO::getProjectId) + .leftJoin(CustomerDO.class, "c", CustomerDO::getId, ProjectOrderDO::getCustomerId) + .leftJoin(ProjectOrderSubDO.class, "d", ProjectOrderSubDO::getId, ProcessBomDO::getProjectSubId) + .orderByDesc(ProcessBomDO::getId) + .disableSubLogicDel() + ; + + query.like(!StringUtils.isEmpty(reqVO.getCode()), ProcessBomDO::getCode, reqVO.getCode()) + .like(!StringUtils.isEmpty(reqVO.getPlanCode()), PlanDO::getPlanNo, reqVO.getPlanCode()) + .like(!StringUtils.isEmpty(reqVO.getProjectCode()), ProjectOrderDO::getCode, reqVO.getProjectCode()) + .like(!StringUtils.isEmpty(reqVO.getCustomerName()), CustomerDO::getName, reqVO.getCustomerName()) + .like(!StringUtils.isEmpty(reqVO.getProjectName()), ProjectOrderDO::getProjectName, reqVO.getProjectName()) + .like(!StringUtils.isEmpty(reqVO.getProjectSubName()), ProjectOrderSubDO::getName, reqVO.getProjectSubName()) + .eq(reqVO.getBomStatus() != null, ProcessBomDO::getBomStatus, reqVO.getBomStatus()) + ; + + return selectPage(reqVO, query); + } + + default ProcessBomDO selectById(Long id) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(ProcessBomDO.class) + .select("concat('BOM-', e.project_sub_code) as code") + .select("a.plan_no as planCode", "b.code as projectCode", "c.name as customerName", "b.project_name as projectName") + .select("d.name as projectSubName") + .leftJoin(PlanDO.class, "a", PlanDO::getId, ProcessBomDO::getPlanId) + .leftJoin(PlanSubDO.class, "e", PlanSubDO::getProjectSubId, ProcessBomDO::getProjectSubId) + .leftJoin(ProjectOrderDO.class, "b", ProjectOrderDO::getId, ProcessBomDO::getProjectId) + .leftJoin(CustomerDO.class, "c", CustomerDO::getId, ProjectOrderDO::getCustomerId) + .leftJoin(ProjectOrderSubDO.class, "d", ProjectOrderSubDO::getId, ProcessBomDO::getProjectSubId) + .eq(ProcessBomDO::getId, id) + .last("LIMIT 1") + .disableSubLogicDel() + ; + return selectOne(query); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processdesign/ProcessDesignMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processdesign/ProcessDesignMapper.java index 9ef6257c..9725b19c 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processdesign/ProcessDesignMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processdesign/ProcessDesignMapper.java @@ -1,13 +1,18 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign; -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.processdesign.vo.ProcessDesignPageReqVO; +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.processdesign.ProcessDesignDO; +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.enums.ProjectPlanStatusEnum; +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.processdesign.vo.*; +import org.springframework.util.StringUtils; /** * 工艺设计 Mapper @@ -18,15 +23,101 @@ import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.*; public interface ProcessDesignMapper extends BaseMapperX { default PageResult selectPage(ProcessDesignPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(ProcessDesignDO::getPlanId, reqVO.getPlanId()) - .eqIfPresent(ProcessDesignDO::getSaleOrderId, reqVO.getSaleOrderId()) - .eqIfPresent(ProcessDesignDO::getSaleOrderSubId, reqVO.getSaleOrderSubId()) - .eqIfPresent(ProcessDesignDO::getProcessDesignType, reqVO.getProcessDesignType()) - .eqIfPresent(ProcessDesignDO::getRemark, reqVO.getRemark()) - .eqIfPresent(ProcessDesignDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(ProcessDesignDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(ProcessDesignDO::getId)); + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(ProcessDesignDO.class) + .select("a.plan_no as planCode","a.has_craft as hasCraft", "a.craft_start_date as craftStartDate", "a.craft_end_date as craftEndDate", "e.name as customerName") + .select("d.code as projectCode", "d.project_name as projectName", "d.business_line as businessLine", "d.property","d.is_urgency as isUrgency") + .select("u1.nickname as projectOwnerName", "u2.nickname as craftOwnerName") + .select("b.blank_date as blankDate", "b.two_dim_date as twoDimDate", "b.three_dim_date as threeDimDate") + .select("u3.nickname as blankOwnerName", "u4.nickname as twoDimOwnerName", "u5.nickname as threeDimOwnerName") + .select("c.name as projectSubName", "b.project_sub_code as projectSubCode") + .select("z.progress") + .leftJoin(PlanDO.class, "a", PlanDO::getId, ProcessDesignDO::getPlanId) + .leftJoin("project_plan_sub b on b.project_plan_id = t.plan_id and b.project_sub_id = t.project_sub_id") + .leftJoin(ProjectOrderSubDO.class, "c", ProjectOrderSubDO::getId, ProcessDesignDO::getProjectSubId) + .leftJoin(ProjectOrderDO.class, "d", ProjectOrderDO::getId, ProcessDesignDO::getProjectId) + .leftJoin(CustomerDO.class, "e", CustomerDO::getId, ProjectOrderDO::getCustomerId) + .leftJoin(AdminUserDO.class, "u1", AdminUserDO::getId, PlanDO::getProjectOwner) + .leftJoin(AdminUserDO.class, "u2", AdminUserDO::getId, PlanDO::getCraftOwner) + .leftJoin("system_users u3 on u3.id = b.blank_owner") + .leftJoin("system_users u4 on u4.id = b.two_dim_owner") + .leftJoin("system_users u5 on u5.id = b.three_dim_owner") + .leftJoin("(select progress,process_design_id FROM pro_process_design_progress where id in (select max(id) FROM pro_process_design_progress GROUP BY process_design_id) ) z on z.process_design_id = t.id") + .orderByDesc(ProcessDesignDO::getId) + .disableSubLogicDel(); + query.like(!StringUtils.isEmpty(reqVO.getPlanCode()), PlanDO::getPlanNo, reqVO.getPlanCode()) + .like(!StringUtils.isEmpty(reqVO.getProjectCode()), ProjectOrderDO::getCode, reqVO.getProjectCode()) + .like(!StringUtils.isEmpty(reqVO.getCustomerName()), CustomerDO::getName, reqVO.getCustomerName()) + .like(!StringUtils.isEmpty(reqVO.getProjectName()), ProjectOrderDO::getProjectName, reqVO.getProjectName()) + .eq(reqVO.getBusinessLine() != null, ProjectOrderDO::getBusinessLine, reqVO.getBusinessLine()) + .eq(reqVO.getProperty() != null, ProjectOrderDO::getProperty, reqVO.getProperty()) + .like(!StringUtils.isEmpty(reqVO.getCraftOwnerName()), "u2.nickname", reqVO.getCraftOwnerName()) + .like(!StringUtils.isEmpty(reqVO.getThreeDimOwnerName()), "u5.nickname", reqVO.getThreeDimOwnerName()) + .like(!StringUtils.isEmpty(reqVO.getTwoDimOwnerName()), "u4.nickname", reqVO.getTwoDimOwnerName()) + .like(!StringUtils.isEmpty(reqVO.getBlankOwnerName()), "u3.nickname", reqVO.getBlankOwnerName()) + .like(!StringUtils.isEmpty(reqVO.getProjectSubName()), ProjectOrderSubDO::getName, reqVO.getProjectSubName()) + .eq(!StringUtils.isEmpty(reqVO.getProcessDesignType()), ProcessDesignDO::getProcessDesignType, reqVO.getProcessDesignType()) + .in(reqVO.getProcessDesignTypeList() != null && !reqVO.getProcessDesignTypeList().isEmpty(), ProcessDesignDO::getProcessDesignType, reqVO.getProcessDesignTypeList()) + .eq(reqVO.getProjectId() != null, ProcessDesignDO::getProjectId, reqVO.getProjectId()) + .eq(reqVO.getProjectSubId() != null, ProcessDesignDO::getProjectSubId, reqVO.getProjectSubId()) + .in(reqVO.getProjectSubIdList() != null && !reqVO.getProjectSubIdList().isEmpty(), ProcessDesignDO::getProjectSubId, reqVO.getProjectSubIdList()) + ; + + if(!StringUtils.isEmpty(reqVO.getOwner())){ + query.and(QueryWrapper -> QueryWrapper.eq("u2.id", reqVO.getOwner()).or().eq("u3.id", reqVO.getOwner()).or().eq("u4.id", reqVO.getOwner()).or().eq("u5.id", reqVO.getOwner())); + } + if(reqVO.getUncompletedDesign() != null && reqVO.getUncompletedDesign()){ + query.and(QueryWrapper -> QueryWrapper.lt("z.progress", "100").ne(PlanDO::getStatus, ProjectPlanStatusEnum.TERMINATE.getCode())); + } + + return selectPage(reqVO, query); + } + + default ProcessDesignDO selectById(Long id) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(ProcessDesignDO.class) + .select("a.plan_no as planCode","a.has_craft as hasCraft", "a.craft_start_date as craftStartDate", "a.craft_end_date as craftEndDate", "e.name as customerName") + .select("d.code as projectCode", "d.project_name as projectName", "d.business_line as businessLine", "d.property","d.is_urgency as isUrgency") + .select("u1.nickname as projectOwnerName", "u2.nickname as craftOwnerName") + .select("b.blank_date as blankDate", "b.two_dim_date as twoDimDate", "b.three_dim_date as threeDimDate") + .select("u3.nickname as blankOwnerName", "u4.nickname as twoDimOwnerName", "u5.nickname as threeDimOwnerName") + .select("c.name as projectSubName", "b.project_sub_code as projectSubCode") + .leftJoin(PlanDO.class, "a", PlanDO::getId, ProcessDesignDO::getPlanId) + .leftJoin("project_plan_sub b on b.project_plan_id = t.plan_id and b.project_sub_id = t.project_sub_id") + .leftJoin(ProjectOrderSubDO.class, "c", ProjectOrderSubDO::getId, ProcessDesignDO::getProjectSubId) + .leftJoin(ProjectOrderDO.class, "d", ProjectOrderDO::getId, ProcessDesignDO::getProjectId) + .leftJoin(CustomerDO.class, "e", CustomerDO::getId, ProjectOrderDO::getCustomerId) + .leftJoin(AdminUserDO.class, "u1", AdminUserDO::getId, PlanDO::getProjectOwner) + .leftJoin(AdminUserDO.class, "u2", AdminUserDO::getId, PlanDO::getCraftOwner) + .leftJoin("system_users u3 on u3.id = b.blank_owner") + .leftJoin("system_users u4 on u4.id = b.two_dim_owner") + .leftJoin("system_users u5 on u5.id = b.three_dim_owner") + .eq(ProcessDesignDO::getId, id) + .last("LIMIT 1") + .disableSubLogicDel(); + return selectOne(query); + } + + default PageResult selectPageOverview(ProcessDesignPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.select(ProcessDesignDO::getProjectId, ProcessDesignDO::getProjectSubId) + .select("c.name as projectSubName") + .select("e.name as customerName") + .select("d.code as projectCode", "d.project_name as projectName", "d.business_line as businessLine", "d.property","d.is_urgency as isUrgency") + .leftJoin(ProjectOrderSubDO.class, "c", ProjectOrderSubDO::getId, ProcessDesignDO::getProjectSubId) + .leftJoin(ProjectOrderDO.class, "d", ProjectOrderDO::getId, ProcessDesignDO::getProjectId) + .leftJoin(CustomerDO.class, "e", CustomerDO::getId, ProjectOrderDO::getCustomerId) + .groupBy("d.id,c.id") + .orderByDesc(ProjectOrderDO::getId) + .disableSubLogicDel(); + + query.in(reqVO.getProcessDesignTypeList() != null && !reqVO.getProcessDesignTypeList().isEmpty(), ProcessDesignDO::getProcessDesignType, reqVO.getProcessDesignTypeList()) + .like(!StringUtils.isEmpty(reqVO.getProjectCode()), ProjectOrderDO::getCode, reqVO.getProjectCode()) + .like(!StringUtils.isEmpty(reqVO.getCustomerName()), CustomerDO::getName, reqVO.getCustomerName()) + .like(!StringUtils.isEmpty(reqVO.getProjectName()), ProjectOrderDO::getProjectName, reqVO.getProjectName()) + .like(!StringUtils.isEmpty(reqVO.getProjectSubName()), ProjectOrderSubDO::getName, reqVO.getProjectSubName()) + ; + 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/dal/mysql/processdesign/ProcessDesignProgressMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processdesign/ProcessDesignProgressMapper.java index bf16ff47..fdb041fd 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processdesign/ProcessDesignProgressMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/processdesign/ProcessDesignProgressMapper.java @@ -1,14 +1,13 @@ -package com.chanko.yunxi.mes.module.heli.dal.mysql.processdesignprogress; +package com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign; -import java.util.*; - -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -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.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; +import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 工艺设计进度 Mapper * @@ -18,11 +17,19 @@ import org.apache.ibatis.annotations.Mapper; public interface ProcessDesignProgressMapper extends BaseMapperX { default List selectListByProcessDesignId(Long processDesignId) { - return selectList(ProcessDesignProgressDO::getProcessDesignId, processDesignId); + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(ProcessDesignProgressDO.class) + .select("u1.nickname as creatorName") + .leftJoin(AdminUserDO.class, "u1", AdminUserDO::getId, ProcessDesignProgressDO::getCreator) + .eq(ProcessDesignProgressDO::getProcessDesignId, processDesignId) + .orderByDesc(ProcessDesignProgressDO::getId) + .disableSubLogicDel(); + + return selectList(query); } default int deleteByProcessDesignId(Long processDesignId) { return delete(ProcessDesignProgressDO::getProcessDesignId, processDesignId); } -} \ 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/projectorder/ProjectOrderSubMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/projectorder/ProjectOrderSubMapper.java index 0261b9e6..a903fc62 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/projectorder/ProjectOrderSubMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/projectorder/ProjectOrderSubMapper.java @@ -2,6 +2,7 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.projectorder; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.module.heli.dal.dataobject.composition.CompositionDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO; import com.github.yulichang.wrapper.MPJLambdaWrapper; @@ -20,10 +21,12 @@ public interface ProjectOrderSubMapper extends BaseMapperX { default List selectListByProjectOrderId(Long projectOrderId) { MPJLambdaWrapper query = new MPJLambdaWrapper<>(); query.selectAll(ProjectOrderSubDO.class) - .select("b.name as compositionName", "p.code as projectOrderCode") + .select("b.name as compositionName", "p.code as projectOrderCode", "e.name as deviceName") + .leftJoin(EquipDO.class, "e", EquipDO::getId, ProjectOrderSubDO::getDeviceModel) .leftJoin(ProjectOrderDO.class, "p", ProjectOrderDO::getId, ProjectOrderSubDO::getProjectOrderId) .leftJoin(CompositionDO.class, "b", CompositionDO::getId, ProjectOrderSubDO::getCompositionId) .disableSubLogicDel() + .orderByAsc(ProjectOrderSubDO::getId) .eq(ProjectOrderSubDO::getProjectOrderId, projectOrderId); return selectList(query); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseorder/PurchaseOrderMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseorder/PurchaseOrderMapper.java new file mode 100644 index 00000000..e24ee345 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseorder/PurchaseOrderMapper.java @@ -0,0 +1,114 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.purchaseorder; + +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.materialplan.vo.MaterialPlanPageReqVO; +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.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; +import com.chanko.yunxi.mes.module.heli.enums.PurchaseStatusEnum; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*; +import org.springframework.util.StringUtils; + +/** + * 采购订单 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PurchaseOrderMapper extends BaseMapperX { + + default PageResult selectPage(PurchaseOrderPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(PurchaseOrderDO.class) + .select("s.name as supplierName","m.project_material_plan_no as materialPlanNo") + .leftJoin(SupplierDO.class, "s", SupplierDO::getId, PurchaseOrderDO::getSupplierId) + .leftJoin(MaterialPlanDO.class, "m", MaterialPlanDO::getId, PurchaseOrderDO::getProjectMaterialPlanId) + .disableSubLogicDel() + .orderByDesc(PurchaseOrderDO::getCreateTime); + query.like(!StringUtils.isEmpty(reqVO.getPurchaseNo()), PurchaseOrderDO::getPurchaseNo, reqVO.getPurchaseNo()) + .like(!StringUtils.isEmpty(reqVO.getSupplierName()), "s.name", reqVO.getSupplierName()) + .like(!StringUtils.isEmpty(reqVO.getMaterialPlanNo()), "m.project_material_plan_no", reqVO.getMaterialPlanNo()) + .apply(!StringUtils.isEmpty(reqVO.getCreateTime()), "DATE_FORMAT(t.create_time,'%Y-%m-%d') = {0}", reqVO.getCreateTime()) + .eq(reqVO.getStatus() != null, PurchaseOrderDO::getStatus, reqVO.getStatus()) + .eq(reqVO.getPurchaseType() != null, PurchaseOrderDO::getPurchaseType, reqVO.getPurchaseType()) + .eq(reqVO.getGoodsType() != null, PurchaseOrderDO::getGoodsType, reqVO.getGoodsType()) + .in(reqVO.getIds() != null && !reqVO.getIds().isEmpty(),PurchaseOrderDO::getId,reqVO.getIds()); + + return selectPage(reqVO, query); + } + default PageResult selectPageByStatus(PurchaseOrderPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(PurchaseOrderDO.class) + .select("s.name as supplierName","m.project_material_plan_no as materialPlanNo") + .leftJoin(SupplierDO.class, "s", SupplierDO::getId, PurchaseOrderDO::getSupplierId) + .leftJoin(MaterialPlanDO.class, "m", MaterialPlanDO::getId, PurchaseOrderDO::getProjectMaterialPlanId) + .disableSubLogicDel() + .orderByDesc(PurchaseOrderDO::getCreateTime); + query.like(!StringUtils.isEmpty(reqVO.getPurchaseNo()), PurchaseOrderDO::getPurchaseNo, reqVO.getPurchaseNo()) + .like(!StringUtils.isEmpty(reqVO.getSupplierName()), "s.name", reqVO.getSupplierName()) + .like(!StringUtils.isEmpty(reqVO.getMaterialPlanNo()), "m.project_material_plan_no", reqVO.getMaterialPlanNo()) + .apply(reqVO.getCreateTime() != null, "DATE_FORMAT(t.create_time,'%Y-%m-%d') = {0}", reqVO.getCreateTime()) + .eq(reqVO.getStatus() != null, PurchaseOrderDO::getStatus, reqVO.getStatus()) + .ne(true, PurchaseOrderDO::getStatus, PurchaseStatusEnum.START.getCode()) + .eq(reqVO.getPurchaseType() != null, PurchaseOrderDO::getPurchaseType, reqVO.getPurchaseType()) + .eq(reqVO.getGoodsType() != null, PurchaseOrderDO::getGoodsType, reqVO.getGoodsType()); + + return selectPage(reqVO, query); + } + + default PageResult selectListWithTax(PurchaseOrderPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(PurchaseOrderDO.class) + .select("s.name as supplierName","m.project_material_plan_no as materialPlanNo","(case when t.tax_ratio!=Null and t.estimated_price!=null then t.estimated_price*t.tax_ratio else '' end) as estimated_price","(case when t.tax_ratio!=Null and t.actual_price!=null then t.actual_price*t.tax_ratio else '' end) as actual_price") + .leftJoin(SupplierDO.class, "s", SupplierDO::getId, PurchaseOrderDO::getSupplierId) + .leftJoin(MaterialPlanDO.class, "m", MaterialPlanDO::getId, PurchaseOrderDO::getProjectMaterialPlanId) + .disableSubLogicDel() + .orderByDesc(PurchaseOrderDO::getCreateTime); + query.like(!StringUtils.isEmpty(reqVO.getPurchaseNo()), PurchaseOrderDO::getPurchaseNo, reqVO.getPurchaseNo()) + .like(!StringUtils.isEmpty(reqVO.getSupplierName()), "s.name", reqVO.getSupplierName()) + .like(!StringUtils.isEmpty(reqVO.getMaterialPlanNo()), "m.project_material_plan_no", reqVO.getMaterialPlanNo()) + .apply(reqVO.getCreateTime() != null, "DATE_FORMAT(t.create_time,'%Y-%m-%d') = {0}", reqVO.getCreateTime()) + .eq(reqVO.getStatus() != null, PurchaseOrderDO::getStatus, reqVO.getStatus()) + .eq(reqVO.getPurchaseType() != null, PurchaseOrderDO::getPurchaseType, reqVO.getPurchaseType()) + .eq(reqVO.getGoodsType() != null, PurchaseOrderDO::getGoodsType, reqVO.getGoodsType()) + .in(reqVO.getIds() != null && !reqVO.getIds().isEmpty(),PurchaseOrderDO::getId,reqVO.getIds()); + + return selectPage(reqVO, query); + } + +// default PageResult selectPage(PurchaseOrderPageReqVO reqVO) { +// return selectPage(reqVO, new LambdaQueryWrapperX() +// .eqIfPresent(PurchaseOrderDO::getId, reqVO.getId()) +// .eqIfPresent(PurchaseOrderDO::getPurchaseNo, reqVO.getPurchaseNo()) +// .eqIfPresent(PurchaseOrderDO::getSupplierId, reqVO.getSupplierId()) +// .eqIfPresent(PurchaseOrderDO::getContractNo, reqVO.getContractNo()) +// .eqIfPresent(PurchaseOrderDO::getPurchaseType, reqVO.getPurchaseType()) +// .eqIfPresent(PurchaseOrderDO::getProjectMaterialPlanId, reqVO.getProjectMaterialPlanId()) +// .eqIfPresent(PurchaseOrderDO::getGoodsType, reqVO.getGoodsType()) +// .eqIfPresent(PurchaseOrderDO::getCurrencyType, reqVO.getCurrencyType()) +// .eqIfPresent(PurchaseOrderDO::getTaxRatio, reqVO.getTaxRatio()) +// .eqIfPresent(PurchaseOrderDO::getEstimatedPrice, reqVO.getEstimatedPrice()) +// .eqIfPresent(PurchaseOrderDO::getActualPrice, reqVO.getActualPrice()) +// .eqIfPresent(PurchaseOrderDO::getStatus, reqVO.getStatus()) +// .eqIfPresent(PurchaseOrderDO::getSubmitUserId, reqVO.getSubmitUserId()) +// .betweenIfPresent(PurchaseOrderDO::getSubmitTime, reqVO.getSubmitTime()) +// .eqIfPresent(PurchaseOrderDO::getAuditor, reqVO.getAuditor()) +// .betweenIfPresent(PurchaseOrderDO::getAuditTime, reqVO.getAuditTime()) +// .eqIfPresent(PurchaseOrderDO::getDescription, reqVO.getDescription()) +// .eqIfPresent(PurchaseOrderDO::getCreator, reqVO.getCreator()) +// .betweenIfPresent(PurchaseOrderDO::getCreateTime, reqVO.getCreateTime()) +// .orderByDesc(PurchaseOrderDO::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/purchaseordermaterial/PurchaseOrderMaterialMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseordermaterial/PurchaseOrderMaterialMapper.java new file mode 100644 index 00000000..ffe9c494 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseordermaterial/PurchaseOrderMaterialMapper.java @@ -0,0 +1,49 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.purchaseordermaterial; + +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.materialplandetail.vo.MaterialPlanDetailPageReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo.*; + +/** + * 采购单物料 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PurchaseOrderMaterialMapper extends BaseMapperX { + + default PageResult selectPage(PurchaseOrderMaterialPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(PurchaseOrderMaterialDO.class) + .select("mat.id as matId","mat.name as matName","mat.code as matCode","mat.spec as matSpec","mat.unit as matUnit","mat.material_type as matType") + .leftJoin(MaterialDO.class, "mat", MaterialDO::getId, PurchaseOrderMaterialDO::getMaterialId) + .disableSubLogicDel() + .orderByAsc(PurchaseOrderMaterialDO::getId); + query.eq(reqVO.getPurchaseOrderId()!=null,PurchaseOrderMaterialDO::getPurchaseOrderId, reqVO.getPurchaseOrderId()).orderByAsc(PurchaseOrderMaterialDO::getCreateTime); + + return selectPage(reqVO, query); + } +// default PageResult selectPage(PurchaseOrderMaterialPageReqVO reqVO) { +// return selectPage(reqVO, new LambdaQueryWrapperX() +// .eqIfPresent(PurchaseOrderMaterialDO::getPurchaseOrderId, reqVO.getPurchaseOrderId()) +// .eqIfPresent(PurchaseOrderMaterialDO::getMaterialId, reqVO.getMaterialId()) +// .eqIfPresent(PurchaseOrderMaterialDO::getPurchaseAmount, reqVO.getPurchaseAmount()) +// .eqIfPresent(PurchaseOrderMaterialDO::getEstimatedPrice, reqVO.getEstimatedPrice()) +// .eqIfPresent(PurchaseOrderMaterialDO::getActualPrice, reqVO.getActualPrice()) +// .betweenIfPresent(PurchaseOrderMaterialDO::getArriveTime, reqVO.getArriveTime()) +// .eqIfPresent(PurchaseOrderMaterialDO::getDescription, reqVO.getDescription()) +// .betweenIfPresent(PurchaseOrderMaterialDO::getCreateTime, reqVO.getCreateTime()) +// .orderByDesc(PurchaseOrderMaterialDO::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/storage/StorageMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storage/StorageMapper.java index 338d5e02..d0e0490d 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storage/StorageMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storage/StorageMapper.java @@ -31,6 +31,7 @@ public interface StorageMapper extends BaseMapperX { query.selectAll(StorageDO.class) .leftJoin(StorageMatDO.class, "sm", StorageMatDO::getStockId, StorageDO::getId) .leftJoin(MaterialDO.class, "mat", MaterialDO::getId, StorageMatDO::getMatId) + .disableSubLogicDel() .orderByDesc(StorageDO::getId); query.like(!StringUtils.isEmpty(reqVO.getMatNo()), MaterialDO::getCode, reqVO.getMatNo()) diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagecheck/StorageCheckMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagecheck/StorageCheckMapper.java index 7f3a49c7..c8ced4c5 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagecheck/StorageCheckMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagecheck/StorageCheckMapper.java @@ -25,6 +25,7 @@ public interface StorageCheckMapper extends BaseMapperX { .eqIfPresent(StorageCheckDO::getNoZero, reqVO.getNoZero()) .eqIfPresent(StorageCheckDO::getDescription, reqVO.getDescription()) .eqIfPresent(StorageCheckDO::getStatus, reqVO.getStatus()) + .neIfPresent(StorageCheckDO::getStatus, 3) .eqIfPresent(StorageCheckDO::getWhId, reqVO.getWhId()) .eqIfPresent(StorageCheckDO::getCreator, reqVO.getCreator()) .betweenIfPresent(StorageCheckDO::getCreateTime, reqVO.getCreateTime()) 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/dal/mysql/supplier/SupplierMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/supplier/SupplierMapper.java index cee100e1..61244e2e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/supplier/SupplierMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/supplier/SupplierMapper.java @@ -2,10 +2,12 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.supplier; import java.util.*; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.dal.dataobject.supplier.SupplierDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.warehouse.WarehouseDO; import org.apache.ibatis.annotations.Mapper; import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; @@ -55,5 +57,14 @@ public interface SupplierMapper extends BaseMapperX { .eqIfPresent(SupplierDO::getTaxNo, reqVO.getTaxNo()) .orderByDesc(SupplierDO::getId)); } + default List> selectSimpleList() { + return selectMaps(new QueryWrapper().select("id", "name").eq("status","1").lambda()); + + } + default List> selectSimpleNoStatusList() { + + return selectMaps(new QueryWrapper().select("id", "name").lambda()); + + } } \ 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/taskdispatch/TaskDispatchDetailMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchDetailMapper.java new file mode 100644 index 00000000..4a824885 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchDetailMapper.java @@ -0,0 +1,28 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.taskdispatchdetail; + +import java.util.*; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +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.dal.dataobject.taskdispatchdetail.TaskDispatchDetailDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 派工明细 Mapper + * + * @author 管理员 + */ +@Mapper +public interface TaskDispatchDetailMapper extends BaseMapperX { + + default List selectListByDispatchId(Long dispatchId) { + return selectList(TaskDispatchDetailDO::getDispatchId, dispatchId); + } + + default int deleteByDispatchId(Long dispatchId) { + return delete(TaskDispatchDetailDO::getDispatchId, dispatchId); + } + +} \ 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/taskdispatch/TaskDispatchMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchMapper.java new file mode 100644 index 00000000..c9205f0f --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchMapper.java @@ -0,0 +1,36 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.taskdispatch; + +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.dal.dataobject.taskdispatch.TaskDispatchDO; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo.*; + +/** + * 派工单 Mapper + * + * @author 管理员 + */ +@Mapper +public interface TaskDispatchMapper extends BaseMapperX { + + default PageResult selectPage(TaskDispatchPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(TaskDispatchDO::getCode, reqVO.getCode()) + .eqIfPresent(TaskDispatchDO::getDispatchType, reqVO.getDispatchType()) + .eqIfPresent(TaskDispatchDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(TaskDispatchDO::getPlanId, reqVO.getPlanId()) + .eqIfPresent(TaskDispatchDO::getProjectId, reqVO.getProjectId()) + .eqIfPresent(TaskDispatchDO::getProjectSubId, reqVO.getProjectSubId()) + .eqIfPresent(TaskDispatchDO::getBomDetailId, reqVO.getBomDetailId()) + .eqIfPresent(TaskDispatchDO::getDispatchStatus, reqVO.getDispatchStatus()) + .eqIfPresent(TaskDispatchDO::getRemark, reqVO.getRemark()) + .eqIfPresent(TaskDispatchDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(TaskDispatchDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(TaskDispatchDO::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/manager/CrossOrderManager.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/manager/CrossOrderManager.java index 71a2f05e..229cf2b8 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/manager/CrossOrderManager.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/manager/CrossOrderManager.java @@ -3,10 +3,16 @@ package com.chanko.yunxi.mes.module.heli.manager; import cn.hutool.core.lang.UUID; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum; +import com.chanko.yunxi.mes.framework.operatelog.core.service.OperateLogFrameworkService; import com.chanko.yunxi.mes.module.heli.controller.admin.deliverorder.vo.DeliverOrderSaveReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomSaveReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.ProcessDesignSaveReqVO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.deliverorder.DeliverOrderDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.deliverorder.DeliverOrderSubDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; 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.storage.StorageDO; @@ -14,25 +20,31 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelog.StorageLogDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO; import com.chanko.yunxi.mes.module.heli.dal.mysql.deliverorder.DeliverOrderSubMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.material.MaterialMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.processbom.ProcessBomMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign.ProcessDesignMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.projectorder.ProjectOrderMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.projectorder.ProjectOrderSubMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.storagelog.StorageLogMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper; import com.chanko.yunxi.mes.module.heli.enums.*; +import com.chanko.yunxi.mes.module.heli.service.plan.PlanService; +import com.chanko.yunxi.mes.module.heli.service.processbom.ProcessBomService; +import com.chanko.yunxi.mes.module.heli.service.processdesign.ProcessDesignService; import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.STOCK_IN; /** - * 跨订单状态交互管理器 + * 跨订单交互管理器 * * @author chenxi * @date 2024-01-31 10:03 @@ -54,6 +66,18 @@ public class CrossOrderManager { private StorageLogMapper storageLogMapper; @Resource private MaterialMapper materialMapper; + @Resource + private PlanService planService; + @Resource + private ProcessDesignService processDesignService; + @Resource + private ProcessDesignMapper processDesignMapper; + @Resource + private ProcessBomService processBomService; + @Resource + private OperateLogFrameworkService operateLogFrameworkService; + @Resource + private ProcessBomMapper processBomMapper; /** * 刷新项目订单发货状态 @@ -191,4 +215,127 @@ public class CrossOrderManager { } }); } + + /** + * 生成或者更新生产计划 + * @param projectId + */ + @Transactional(rollbackFor = Exception.class) + public void generatePlan(Long projectId) { + // 锁定该订单 + projectOrderMapper.selectOne(new LambdaQueryWrapper() {{ + eq(ProjectOrderDO::getId, projectId); + last("LIMIT 1 FOR UPDATE"); + }}); + Long planId = planService.generatePlanByProjectId(projectId); + // 同时生成工艺设计 + generateProcessDesign(projectId, planId); + } + + /** + * 生成或更新工艺设计 + * @param projectId + * @param planId + */ + @Transactional(rollbackFor = Exception.class) + public void generateProcessDesign(Long projectId, Long planId){ + // 判断是否已经生成 + List projectSubList = projectOrderSubMapper.selectListByProjectOrderId(projectId); + if(projectSubList != null){ + List projectSubIdList = projectSubList.stream().map(ProjectOrderSubDO::getId).collect(Collectors.toList()); + List processDesignDOList = processDesignMapper.selectList(new LambdaQueryWrapper() {{ + in(ProcessDesignDO::getProjectSubId, projectSubIdList); + eq(ProcessDesignDO::getProcessDesignType, ProcessDesignTypeEnum.BLUEPRINT_3D.name()); + }}); + // 只考虑增加情况 + if( projectSubIdList.size() > processDesignDOList.size()){ + List existProjectSubIdList = processDesignDOList.stream().map(ProcessDesignDO::getProjectSubId).collect(Collectors.toList()); + List needSavedProjectSubIdList = projectSubIdList.stream().filter(projectSubId -> !existProjectSubIdList.contains(projectSubId)).collect(Collectors.toList()); + // 如未插入过 则生成铸造工艺 + if(existProjectSubIdList.isEmpty()){ + ProcessDesignSaveReqVO saveReqVO = new ProcessDesignSaveReqVO(); + saveReqVO.setPlanId(planId) + .setProcessDesignType(ProcessDesignTypeEnum.BLUEPRINT_FOUNDRY_TECHNOLOGY.name()) + .setStatus(ValidStatusEnum.VALID.getCode()) + .setProjectId(projectId); + processDesignService.createProcessDesign(saveReqVO); + } + // 按每个子项目生成工艺设计 + if(!needSavedProjectSubIdList.isEmpty()){ + LocalDateTime startTime = LocalDateTime.now(); + needSavedProjectSubIdList.forEach(projectSubId -> { + ProcessDesignSaveReqVO threeD = new ProcessDesignSaveReqVO(); + threeD.setPlanId(planId) + .setProcessDesignType(ProcessDesignTypeEnum.BLUEPRINT_3D.name()) + .setStatus(ValidStatusEnum.VALID.getCode()) + .setProjectSubId(projectSubId) + .setProjectId(projectId); + processDesignService.createProcessDesign(threeD); + + ProcessDesignSaveReqVO twoD = new ProcessDesignSaveReqVO(); + twoD.setPlanId(planId) + .setProcessDesignType(ProcessDesignTypeEnum.BLUEPRINT_2D.name()) + .setStatus(ValidStatusEnum.VALID.getCode()) + .setProjectSubId(projectSubId) + .setProjectId(projectId); + processDesignService.createProcessDesign(twoD); + + ProcessDesignSaveReqVO blank = new ProcessDesignSaveReqVO(); + blank.setPlanId(planId) + .setProcessDesignType(ProcessDesignTypeEnum.BLUEPRINT_WORKBLANK.name()) + .setStatus(ValidStatusEnum.VALID.getCode()) + .setProjectSubId(projectSubId) + .setProjectId(projectId); + processDesignService.createProcessDesign(blank); + + ProcessBomSaveReqVO bomSaveReqVO = new ProcessBomSaveReqVO(); + bomSaveReqVO.setPlanId(planId) + .setProjectId(projectId) + .setProjectSubId(projectSubId) + .setVersion(0) + .setBomStatus(ProcessBomStatusEnum.SAVE.getCode()) + .setStatus(ValidStatusEnum.VALID.getCode()) + .setActive(OperateTypeEnum.CREATE.name()); + processBomService.operateProcessBom(bomSaveReqVO); + + // 手动记录日志 + operateLogFrameworkService.createOperateLog(startTime, + BusinesTypeEnum.PROCESS_BOM.name(), + bomSaveReqVO.getId(), + OperateTypeEnum.CREATE.getType(), + bomSaveReqVO.getActiveOpinion()); + }); + } + } + } + } + + /** + * 订单终止 更新计划状态 + * @param projectId + */ + @Transactional(rollbackFor = Exception.class) + public void updatePlanStatusToTerminate(Long projectId) { + planService.updatePlanStatusToTerminateByProjectId(projectId); + // 同时更新工艺设计状态 + updateProcessDesignStatusToTerminate(projectId); + } + + /** + * 订单终止 更新工艺设计状态 + * @param projectId + */ + public void updateProcessDesignStatusToTerminate(Long projectId){ + List processBomDOList = processBomMapper.selectList(new LambdaQueryWrapper() {{ + eq(ProcessBomDO::getProjectId, projectId); + }}); + if(!processBomDOList.isEmpty()){ + processBomDOList.forEach(processBomDO -> { + processBomDO.setBomStatus(ProcessBomStatusEnum.TERMINATE.getCode()); + }); + processBomMapper.updateBatch(processBomDOList); + } + } + + } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java index 75ec5dc2..f9a515e1 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/customer/CustomerServiceImpl.java @@ -1,26 +1,20 @@ package com.chanko.yunxi.mes.module.heli.service.customer; -import cn.hutool.core.lang.UUID; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; -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.customer.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; 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.controller.admin.customer.vo.CustomerPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.customer.vo.CustomerSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.customer.CustomerDO; import com.chanko.yunxi.mes.module.heli.dal.mysql.customer.CustomerMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.CUSTOMER; -import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.WORKSHOP; -import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.CODE_REPEAT; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS; /** * 客户新表 Service 实现类 diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipService.java index 9247a3d0..309daf1f 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipService.java @@ -1,55 +1,58 @@ -package com.chanko.yunxi.mes.module.heli.service.equip; - -import java.util.*; -import javax.validation.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; - -/** - * 设备信息 Service 接口 - * - * @author 管理员 - */ -public interface EquipService { - - /** - * 创建设备信息 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createEquip(@Valid EquipSaveReqVO createReqVO); - - /** - * 更新设备信息 - * - * @param updateReqVO 更新信息 - */ - void updateEquip(@Valid EquipSaveReqVO updateReqVO); - - /** - * 删除设备信息 - * - * @param id 编号 - */ - void deleteEquip(Long id); - - /** - * 获得设备信息 - * - * @param id 编号 - * @return 设备信息 - */ - EquipDO getEquip(Long id); - - /** - * 获得设备信息分页 - * - * @param pageReqVO 分页查询 - * @return 设备信息分页 - */ - PageResult getEquipPage(EquipPageReqVO pageReqVO); - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.equip; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.equip.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 设备信息 Service 接口 + * + * @author 管理员 + */ +public interface EquipService { + + /** + * 创建设备信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createEquip(@Valid EquipSaveReqVO createReqVO); + + /** + * 更新设备信息 + * + * @param updateReqVO 更新信息 + */ + void updateEquip(@Valid EquipSaveReqVO updateReqVO); + + /** + * 删除设备信息 + * + * @param id 编号 + */ + void deleteEquip(Long id); + + /** + * 获得设备信息 + * + * @param id 编号 + * @return 设备信息 + */ + EquipDO getEquip(Long id); + + /** + * 获得设备信息分页 + * + * @param pageReqVO 分页查询 + * @return 设备信息分页 + */ + PageResult getEquipPage(EquipPageReqVO pageReqVO); + + List> getEquipSimpleList(); + + List> getEquipNoStatusSimpleList(); +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipServiceImpl.java index 8eec3f8b..c6e773ed 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/equip/EquipServiceImpl.java @@ -1,74 +1,83 @@ -package com.chanko.yunxi.mes.module.heli.service.equip; - -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.equip.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; -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.equip.EquipMapper; - -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 EquipServiceImpl implements EquipService { - - @Resource - private EquipMapper equipMapper; - - @Override - public Long createEquip(EquipSaveReqVO createReqVO) { - // 插入 - EquipDO equip = BeanUtils.toBean(createReqVO, EquipDO.class); - equipMapper.insert(equip); - // 返回 - return equip.getId(); - } - - @Override - public void updateEquip(EquipSaveReqVO updateReqVO) { - // 校验存在 - validateEquipExists(updateReqVO.getId()); - // 更新 - EquipDO updateObj = BeanUtils.toBean(updateReqVO, EquipDO.class); - equipMapper.updateById(updateObj); - } - - @Override - public void deleteEquip(Long id) { - // 校验存在 - validateEquipExists(id); - // 删除 - equipMapper.deleteById(id); - } - - private void validateEquipExists(Long id) { - if (equipMapper.selectById(id) == null) { - throw exception(EQUIP_NOT_EXISTS); - } - } - - @Override - public EquipDO getEquip(Long id) { - return equipMapper.selectById(id); - } - - @Override - public PageResult getEquipPage(EquipPageReqVO pageReqVO) { - return equipMapper.selectPage(pageReqVO); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.equip; + +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.equip.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.equip.EquipDO; +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.equip.EquipMapper; + +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 EquipServiceImpl implements EquipService { + + @Resource + private EquipMapper equipMapper; + + @Override + public Long createEquip(EquipSaveReqVO createReqVO) { + // 插入 + EquipDO equip = BeanUtils.toBean(createReqVO, EquipDO.class); + equipMapper.insert(equip); + // 返回 + return equip.getId(); + } + + @Override + public void updateEquip(EquipSaveReqVO updateReqVO) { + // 校验存在 + validateEquipExists(updateReqVO.getId()); + // 更新 + EquipDO updateObj = BeanUtils.toBean(updateReqVO, EquipDO.class); + equipMapper.updateById(updateObj); + } + + @Override + public void deleteEquip(Long id) { + // 校验存在 + validateEquipExists(id); + // 删除 + equipMapper.deleteById(id); + } + + private void validateEquipExists(Long id) { + if (equipMapper.selectById(id) == null) { + throw exception(EQUIP_NOT_EXISTS); + } + } + + @Override + public EquipDO getEquip(Long id) { + return equipMapper.selectById(id); + } + + @Override + public PageResult getEquipPage(EquipPageReqVO pageReqVO) { + return equipMapper.selectPage(pageReqVO); + } + + @Override + public List> getEquipSimpleList(){ + return equipMapper.selectSimpleList(); + } + + @Override + public List> getEquipNoStatusSimpleList(){ + return equipMapper.selectNoStatusSimpleList(); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanService.java new file mode 100644 index 00000000..4b2a60b4 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.materialplan; + +import java.util.*; +import javax.validation.*; +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; + +/** + * 物料需求计划 Service 接口 + * + * @author 管理员 + */ +public interface MaterialPlanService { + + /** + * 创建物料需求计划 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createMaterialPlan(@Valid MaterialPlanSaveReqVO createReqVO); + + /** + * 更新物料需求计划 + * + * @param updateReqVO 更新信息 + */ + void updateMaterialPlan(@Valid MaterialPlanSaveReqVO updateReqVO); + + /** + * 删除物料需求计划 + * + * @param id 编号 + */ + void deleteMaterialPlan(Long id); + + /** + * 获得物料需求计划 + * + * @param id 编号 + * @return 物料需求计划 + */ + MaterialPlanDO getMaterialPlan(Long id); + + /** + * 获得物料需求计划分页 + * + * @param pageReqVO 分页查询 + * @return 物料需求计划分页 + */ + PageResult getMaterialPlanPage(MaterialPlanPageReqVO 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/materialplan/MaterialPlanServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanServiceImpl.java new file mode 100644 index 00000000..c00cf425 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplan/MaterialPlanServiceImpl.java @@ -0,0 +1,103 @@ +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.time.LocalDateTime; +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); + + LocalDateTime currTime = LocalDateTime.now(); + if(updateReqVO.getStatus()==2){ + updateObj.setSubmitTime(currTime); + } + if(updateReqVO.getStatus()== 3 || updateReqVO.getStatus() == 4){ + updateObj.setAuditTime(currTime); + } + + 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/materialplandetail/MaterialPlanDetailService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplandetail/MaterialPlanDetailService.java new file mode 100644 index 00000000..c498f742 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplandetail/MaterialPlanDetailService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.materialplandetail; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 物料需求计划物料详情 Service 接口 + * + * @author 管理员 + */ +public interface MaterialPlanDetailService { + + /** + * 创建物料需求计划物料详情 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createMaterialPlanDetail(@Valid MaterialPlanDetailSaveReqVO createReqVO); + + /** + * 更新物料需求计划物料详情 + * + * @param updateReqVO 更新信息 + */ + void updateMaterialPlanDetail(@Valid MaterialPlanDetailSaveReqVO updateReqVO); + + /** + * 删除物料需求计划物料详情 + * + * @param id 编号 + */ + void deleteMaterialPlanDetail(Long id); + + /** + * 获得物料需求计划物料详情 + * + * @param id 编号 + * @return 物料需求计划物料详情 + */ + MaterialPlanDetailDO getMaterialPlanDetail(Long id); + + /** + * 获得物料需求计划物料详情分页 + * + * @param pageReqVO 分页查询 + * @return 物料需求计划物料详情分页 + */ + PageResult getMaterialPlanDetailPage(MaterialPlanDetailPageReqVO 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/materialplandetail/MaterialPlanDetailServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplandetail/MaterialPlanDetailServiceImpl.java new file mode 100644 index 00000000..cd3ecc70 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/materialplandetail/MaterialPlanDetailServiceImpl.java @@ -0,0 +1,74 @@ +package com.chanko.yunxi.mes.module.heli.service.materialplandetail; + +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.materialplandetail.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO; +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.materialplandetail.MaterialPlanDetailMapper; + +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 MaterialPlanDetailServiceImpl implements MaterialPlanDetailService { + + @Resource + private MaterialPlanDetailMapper materialPlanDetailMapper; + + @Override + public Long createMaterialPlanDetail(MaterialPlanDetailSaveReqVO createReqVO) { + // 插入 + MaterialPlanDetailDO materialPlanDetail = BeanUtils.toBean(createReqVO, MaterialPlanDetailDO.class); + materialPlanDetailMapper.insert(materialPlanDetail); + // 返回 + return materialPlanDetail.getId(); + } + + @Override + public void updateMaterialPlanDetail(MaterialPlanDetailSaveReqVO updateReqVO) { + // 校验存在 + validateMaterialPlanDetailExists(updateReqVO.getId()); + // 更新 + MaterialPlanDetailDO updateObj = BeanUtils.toBean(updateReqVO, MaterialPlanDetailDO.class); + materialPlanDetailMapper.updateById(updateObj); + } + + @Override + public void deleteMaterialPlanDetail(Long id) { + // 校验存在 + validateMaterialPlanDetailExists(id); + // 删除 + materialPlanDetailMapper.deleteById(id); + } + + private void validateMaterialPlanDetailExists(Long id) { + if (materialPlanDetailMapper.selectById(id) == null) { + throw exception(MATERIAL_PLAN_DETAIL_NOT_EXISTS); + } + } + + @Override + public MaterialPlanDetailDO getMaterialPlanDetail(Long id) { + return materialPlanDetailMapper.selectById(id); + } + + @Override + public PageResult getMaterialPlanDetailPage(MaterialPlanDetailPageReqVO pageReqVO) { + return materialPlanDetailMapper.selectPage(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/mouldtype/MouldTypeService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeService.java index 892c3c55..2d30b5b6 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeService.java @@ -54,4 +54,6 @@ public interface MouldTypeService { List> getMouldTypeSimpleList(); + List> getMouldTypeNoStatusSimpleList(); + } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java index d561d29a..f84cc4e4 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/mouldtype/MouldTypeServiceImpl.java @@ -75,4 +75,11 @@ public class MouldTypeServiceImpl implements MouldTypeService { public List> getMouldTypeSimpleList(){ return mouldTypeMapper.selectSimpleList(); } + + @Override + public List> getMouldTypeNoStatusSimpleList(){ + return mouldTypeMapper.selectNoStatusSimpleList(); + } } + + 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 new file mode 100644 index 00000000..efc6028c --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanService.java @@ -0,0 +1,60 @@ +package com.chanko.yunxi.mes.module.heli.service.plan; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; + +import javax.validation.Valid; + +/** + * 生产计划 Service 接口 + * + * @author 管理员 + */ +public interface PlanService { + + /** + * 创建生产计划 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPlan(@Valid PlanSaveReqVO createReqVO); + + /** + * 更新生产计划 + * + * @param updateReqVO 更新信息 + */ + void updatePlan(@Valid PlanSaveReqVO updateReqVO); + + /** + * 删除生产计划 + * + * @param id 编号 + */ + void deletePlan(Long id); + + /** + * 获得生产计划 + * + * @param id 编号 + * @return 生产计划 + */ + PlanDO getPlan(Long id); + + /** + * 获得生产计划分页 + * + * @param pageReqVO 分页查询 + * @return 生产计划分页 + */ + PageResult getPlanPage(PlanPageReqVO pageReqVO); + + PageResult getPlanPageByStatus(PlanPageReqVO pageReqVO); + + Long 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 new file mode 100644 index 00000000..fbe421c6 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java @@ -0,0 +1,223 @@ +package com.chanko.yunxi.mes.module.heli.service.plan; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.util.object.BeanUtils; +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanSaveReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.plansub.vo.PlanSubPageReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plansub.PlanSubDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.serialnumber.SerialNumberDO; +import com.chanko.yunxi.mes.module.heli.dal.mysql.plan.PlanMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.plansub.PlanSubMapper; +import com.chanko.yunxi.mes.module.heli.enums.ProjectPlanStatusEnum; +import com.chanko.yunxi.mes.module.heli.service.projectorder.ProjectOrderService; +import com.chanko.yunxi.mes.module.heli.service.serialnumber.SerialNumberService; +import jodd.util.StringUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.thymeleaf.util.StringUtils; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.PROJECT_PLAN; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.PLAN_NOT_EXISTS; + +/** + * 生产计划 Service 实现类 + * + * @author 管理员 + */ +@Slf4j +@Service +@Validated +public class PlanServiceImpl implements PlanService { + + @Resource + private PlanMapper planMapper; + + @Resource + private PlanSubMapper planSubMapper; + + @Resource + private ProjectOrderService projectOrderService; + + @Resource + private SerialNumberService serialNumberService; + + @Override + public Long createPlan(PlanSaveReqVO createReqVO) { + // 插入 + PlanDO plan = BeanUtils.toBean(createReqVO, PlanDO.class); + + // 月度流水号 + SerialNumberDO serialNumberDO = new SerialNumberDO(); + serialNumberDO = serialNumberService.getSerialNumber(PROJECT_PLAN.name(), new SimpleDateFormat("yyyyMM").format(new Date())); + serialNumberDO.setSerialNumber(serialNumberDO.getSerialNumber()+1); + + plan.setPlanNo(PROJECT_PLAN.getCode(serialNumberDO.getSerialNumber().toString())); + plan.setChangeNum(0); + planMapper.insert(plan); + // 回写序列记录 + serialNumberService.updateSerialNumber(serialNumberDO); + // 返回 + return plan.getId(); + } + + @Override + public void updatePlan(PlanSaveReqVO updateReqVO) { + // 校验存在 + validatePlanExists(updateReqVO.getId()); + // 更新 + PlanDO updateObj = BeanUtils.toBean(updateReqVO, PlanDO.class); + planMapper.updateById(updateObj); + } + + @Override + public void deletePlan(Long id) { + // 校验存在 + validatePlanExists(id); + // 删除 + planMapper.deleteById(id); + } + + private void validatePlanExists(Long id) { + if (planMapper.selectById(id) == null) { + throw exception(PLAN_NOT_EXISTS); + } + } + + @Override + public PlanDO getPlan(Long id) { + return planMapper.selectById(id); + } + + @Override + public PageResult getPlanPage(PlanPageReqVO pageReqVO) { + return planMapper.selectPage(pageReqVO); + } + + @Override + public PageResult getPlanPageByStatus(PlanPageReqVO pageReqVO) { + return planMapper.selectPageByStatus(pageReqVO); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Long generatePlanByProjectId(Long projectId){ + Long id = null; + // 查询最近归档历史并对比变化字段 + try { + PlanDO planDO = planMapper.selectOne(new LambdaQueryWrapper() {{ + eq(PlanDO::getProjectId, projectId); + orderByDesc(PlanDO::getId); + last("LIMIT 1"); + }}); + // 生成生产计划子项目信息 + List projectOrderSubDOs = projectOrderService.getProjectOrderSubListByProjectOrderId(projectId); + if(planDO != null){ + // 设置项目更新次数 + planDO.setChangeNum(planDO.getChangeNum()+1); + // 设置项目更新时间 + planDO.setChangeLastDate(LocalDateTime.now()); + // 设置生产计划状态 + planDO.setStatus(ProjectPlanStatusEnum.CHANGE.getCode()); + planMapper.updateById(planDO); + + PlanSubPageReqVO pageReqVO = new PlanSubPageReqVO(); + pageReqVO.setPageNo(1); + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = planSubMapper.selectPage(pageReqVO).getList(); + + for(ProjectOrderSubDO item : projectOrderSubDOs){ + if(!list.stream().anyMatch(a ->a.getProjectSubId().equals(item.getId()))) { + PlanSubDO planSubDO = new PlanSubDO(); + planSubDO.setProjectPlanId(planDO.getId()); + planSubDO.setProjectId(projectId); + planSubDO.setProjectSubId(item.getId()); + if(!StringUtils.isEmpty(item.getDeviceModel())){ + planSubDO.setEquipId(Long.parseLong(item.getDeviceModel())); + } + + planSubMapper.insert(planSubDO); + } + else{ + PlanSubDO planSubDO = list.stream().filter(ps -> ps.getProjectSubId().equals(item.getId())).findFirst().get(); + if(!StringUtils.isEmpty(item.getDeviceModel())){ + planSubDO.setEquipId(Long.parseLong(item.getDeviceModel())); + } + + planSubMapper.updateById(planSubDO); + } + } + + }else{ + planDO = new PlanDO(); + planDO.setProjectId(projectId); + // 设置项目更新次数 + planDO.setChangeNum(0); + // 设置生产计划状态 + planDO.setStatus(ProjectPlanStatusEnum.START.getCode()); + + // 月度流水号 + SerialNumberDO serialNumberDO = new SerialNumberDO(); + serialNumberDO = serialNumberService.getSerialNumber(PROJECT_PLAN.name(), new SimpleDateFormat("yyyyMM").format(new Date())); + serialNumberDO.setSerialNumber(serialNumberDO.getSerialNumber()+1); + + planDO.setPlanNo(PROJECT_PLAN.getCode(serialNumberDO.getSerialNumber().toString())); + + planMapper.insert(planDO); + // 回写序列记录 + serialNumberService.updateSerialNumber(serialNumberDO); + + for(ProjectOrderSubDO item : projectOrderSubDOs){ + PlanSubDO planSubDO = new PlanSubDO(); + planSubDO.setProjectPlanId(planDO.getId()); + planSubDO.setProjectId(projectId); + planSubDO.setProjectSubId(item.getId()); + if(!StringUtils.isEmpty(item.getDeviceModel())){ + planSubDO.setEquipId(Long.parseLong(item.getDeviceModel())); + } + planSubMapper.insert(planSubDO); + } + } + id = planDO.getId(); + }catch (Exception e){ + log.error("base projectId to generate planDo error, id: {}, exception: {}", projectId, e.getMessage(), e); + } + return id; + } + @Override + public void updatePlanStatusToTerminateByProjectId(Long projectId){ + // 查询最近归档历史并对比变化字段 + try { + PlanDO planDO = planMapper.selectOne(new LambdaQueryWrapper() {{ + eq(PlanDO::getProjectId, projectId); + orderByDesc(PlanDO::getId); + last("LIMIT 1"); + }}); + if(planDO != null){ + // 设置项目更新次数 + planDO.setChangeNum(planDO.getChangeNum()+1); + // 设置项目更新时间 + planDO.setChangeLastDate(LocalDateTime.now()); + // 设置生产计划状态 + planDO.setStatus(ProjectPlanStatusEnum.TERMINATE.getCode()); + planMapper.updateById(planDO); + } + }catch (Exception e){ + log.error("base projectId to update planDo's status error, id: {}, exception: {}", projectId, e.getMessage(), e); + } + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansub/PlanSubService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansub/PlanSubService.java new file mode 100644 index 00000000..06b9ea71 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansub/PlanSubService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.plansub; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.plansub.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plansub.PlanSubDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 生产计划子项目 Service 接口 + * + * @author 管理员 + */ +public interface PlanSubService { + + /** + * 创建生产计划子项目 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPlanSub(@Valid PlanSubSaveReqVO createReqVO); + + /** + * 更新生产计划子项目 + * + * @param updateReqVO 更新信息 + */ + void updatePlanSub(@Valid PlanSubSaveReqVO updateReqVO); + + /** + * 删除生产计划子项目 + * + * @param id 编号 + */ + void deletePlanSub(Long id); + + /** + * 获得生产计划子项目 + * + * @param id 编号 + * @return 生产计划子项目 + */ + PlanSubDO getPlanSub(Long id); + + /** + * 获得生产计划子项目分页 + * + * @param pageReqVO 分页查询 + * @return 生产计划子项目分页 + */ + PageResult getPlanSubPage(PlanSubPageReqVO 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/plansub/PlanSubServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansub/PlanSubServiceImpl.java new file mode 100644 index 00000000..b0259406 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansub/PlanSubServiceImpl.java @@ -0,0 +1,74 @@ +package com.chanko.yunxi.mes.module.heli.service.plansub; + +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.plansub.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plansub.PlanSubDO; +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.plansub.PlanSubMapper; + +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 PlanSubServiceImpl implements PlanSubService { + + @Resource + private PlanSubMapper planSubMapper; + + @Override + public Long createPlanSub(PlanSubSaveReqVO createReqVO) { + // 插入 + PlanSubDO planSub = BeanUtils.toBean(createReqVO, PlanSubDO.class); + planSubMapper.insert(planSub); + // 返回 + return planSub.getId(); + } + + @Override + public void updatePlanSub(PlanSubSaveReqVO updateReqVO) { + // 校验存在 + validatePlanSubExists(updateReqVO.getId()); + // 更新 + PlanSubDO updateObj = BeanUtils.toBean(updateReqVO, PlanSubDO.class); + planSubMapper.updateById(updateObj); + } + + @Override + public void deletePlanSub(Long id) { + // 校验存在 + validatePlanSubExists(id); + // 删除 + planSubMapper.deleteById(id); + } + + private void validatePlanSubExists(Long id) { + if (planSubMapper.selectById(id) == null) { + throw exception(PLAN_SUB_NOT_EXISTS); + } + } + + @Override + public PlanSubDO getPlanSub(Long id) { + return planSubMapper.selectById(id); + } + + @Override + public PageResult getPlanSubPage(PlanSubPageReqVO pageReqVO) { + return planSubMapper.selectPage(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/processbom/ProcessBomService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomService.java new file mode 100644 index 00000000..578f4bca --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomService.java @@ -0,0 +1,68 @@ +package com.chanko.yunxi.mes.module.heli.service.processbom; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO; + +import javax.validation.Valid; +import java.util.List; + +/** + * 工艺bom Service 接口 + * + * @author 管理员 + */ +public interface ProcessBomService { + + /** + * 创建工艺bom + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createProcessBom(@Valid ProcessBomSaveReqVO createReqVO); + + /** + * 更新工艺bom + * + * @param updateReqVO 更新信息 + */ + void updateProcessBom(@Valid ProcessBomSaveReqVO updateReqVO); + + /** + * 删除工艺bom + * + * @param id 编号 + */ + void deleteProcessBom(Long id); + + /** + * 获得工艺bom + * + * @param id 编号 + * @return 工艺bom + */ + ProcessBomDO getProcessBom(Long id); + + /** + * 获得工艺bom分页 + * + * @param pageReqVO 分页查询 + * @return 工艺bom分页 + */ + PageResult getProcessBomPage(ProcessBomPageReqVO pageReqVO); + + // ==================== 子表(工艺bom明细) ==================== + + /** + * 获得工艺bom明细列表 + * + * @param bomId bom id + * @return 工艺bom明细列表 + */ + List getProcessBomDetailListByBomId(Long bomId); + + void operateProcessBom(ProcessBomSaveReqVO operateReqVO); +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomServiceImpl.java new file mode 100644 index 00000000..d8317517 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomServiceImpl.java @@ -0,0 +1,142 @@ +package com.chanko.yunxi.mes.module.heli.service.processbom; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.processbom.vo.ProcessBomSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processbom.ProcessBomDetailDO; +import com.chanko.yunxi.mes.module.heli.dal.mysql.processbom.ProcessBomDetailMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.processbom.ProcessBomMapper; +import com.chanko.yunxi.mes.module.heli.enums.ProcessBomStatusEnum; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 工艺bom Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class ProcessBomServiceImpl implements ProcessBomService { + + @Resource + private ProcessBomMapper processBomMapper; + @Resource + private ProcessBomDetailMapper processBomDetailMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public Long createProcessBom(ProcessBomSaveReqVO createReqVO) { + // 插入 + ProcessBomDO processBom = BeanUtils.toBean(createReqVO, ProcessBomDO.class); + processBomMapper.insert(processBom); + + // 插入子表 + if(createReqVO.getProcessBomDetails() != null && !createReqVO.getProcessBomDetails().isEmpty()) createProcessBomDetailList(processBom.getId(), createReqVO.getProcessBomDetails()); + createReqVO.setId(processBom.getId()); + // 返回 + return processBom.getId(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateProcessBom(ProcessBomSaveReqVO updateReqVO) { + // 校验存在 + validateProcessBomExists(updateReqVO.getId()); + // 提交的时候 明细不容许为空 + OperateTypeEnum operateTypeEnum = OperateTypeEnum.valueOf(updateReqVO.getActive()); + if(operateTypeEnum == OperateTypeEnum.SUBMIT){ + if(updateReqVO.getProcessBomDetails() == null || updateReqVO.getProcessBomDetails().isEmpty()){ + throw exception(PROCESS_BOM_DETAIL_NOT_EXISTS); + } + } + + // 更新 + ProcessBomDO updateObj = BeanUtils.toBean(updateReqVO, ProcessBomDO.class); + if(!updateObj.canOperate(operateTypeEnum)){ + throw exception(INVALID_OPERATE); + } + + // 如提交版本+1 + if(operateTypeEnum == OperateTypeEnum.SUBMIT){ + updateObj.setVersion(updateObj.getVersion()+1); + } + + updateObj.setBomStatus(ProcessBomStatusEnum.valueOf(updateReqVO.getActive()).getCode()); + processBomMapper.updateById(updateObj); + + // 更新子表 + updateProcessBomDetailList(updateReqVO.getId(), updateReqVO.getProcessBomDetails()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteProcessBom(Long id) { + // 校验存在 + validateProcessBomExists(id); + // 删除 + processBomMapper.deleteById(id); + + // 删除子表 + deleteProcessBomDetailByBomId(id); + } + + private void validateProcessBomExists(Long id) { + if (processBomMapper.selectById(id) == null) { + throw exception(PROCESS_BOM_NOT_EXISTS); + } + } + + @Override + public ProcessBomDO getProcessBom(Long id) { + return processBomMapper.selectById(id); + } + + @Override + public PageResult getProcessBomPage(ProcessBomPageReqVO pageReqVO) { + return processBomMapper.selectPage(pageReqVO); + } + + // ==================== 子表(工艺bom明细) ==================== + + @Override + public List getProcessBomDetailListByBomId(Long bomId) { + return processBomDetailMapper.selectListByBomId(bomId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void operateProcessBom(ProcessBomSaveReqVO operateReqVO) { + if(operateReqVO.getId() == null){ + createProcessBom(operateReqVO); + }else{ + updateProcessBom(operateReqVO); + } + } + + private void createProcessBomDetailList(Long bomId, List list) { + list.forEach(o -> o.setBomId(bomId)); + processBomDetailMapper.insertBatch(list); + } + + private void updateProcessBomDetailList(Long bomId, List list) { + deleteProcessBomDetailByBomId(bomId); + list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 + createProcessBomDetailList(bomId, list); + } + + private void deleteProcessBomDetailByBomId(Long bomId) { + processBomDetailMapper.deleteByBomId(bomId); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignService.java index 6a3b9bbd..5bc3a68b 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignService.java @@ -1,66 +1,72 @@ -package com.chanko.yunxi.mes.module.heli.service.processdesign; - -import java.util.*; -import javax.validation.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; - -/** - * 工艺设计 Service 接口 - * - * @author 管理员 - */ -public interface ProcessDesignService { - - /** - * 创建工艺设计 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createProcessDesign(@Valid ProcessDesignSaveReqVO createReqVO); - - /** - * 更新工艺设计 - * - * @param updateReqVO 更新信息 - */ - void updateProcessDesign(@Valid ProcessDesignSaveReqVO updateReqVO); - - /** - * 删除工艺设计 - * - * @param id 编号 - */ - void deleteProcessDesign(Long id); - - /** - * 获得工艺设计 - * - * @param id 编号 - * @return 工艺设计 - */ - ProcessDesignDO getProcessDesign(Long id); - - /** - * 获得工艺设计分页 - * - * @param pageReqVO 分页查询 - * @return 工艺设计分页 - */ - PageResult getProcessDesignPage(ProcessDesignPageReqVO pageReqVO); - - // ==================== 子表(工艺设计进度) ==================== - - /** - * 获得工艺设计进度列表 - * - * @param processDesignId 工艺设计id - * @return 工艺设计进度列表 - */ - List getProcessDesignProgressListByProcessDesignId(Long processDesignId); - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.processdesign; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.module.heli.vo.WarningMessageVO; + +/** + * 工艺设计 Service 接口 + * + * @author 管理员 + */ +public interface ProcessDesignService { + + /** + * 创建工艺设计 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createProcessDesign(@Valid ProcessDesignSaveReqVO createReqVO); + + /** + * 更新工艺设计 + * + * @param updateReqVO 更新信息 + */ + Long updateProcessDesign(@Valid ProcessDesignSaveReqVO updateReqVO); + + /** + * 删除工艺设计 + * + * @param id 编号 + */ + void deleteProcessDesign(Long id); + + /** + * 获得工艺设计 + * + * @param id 编号 + * @return 工艺设计 + */ + ProcessDesignDO getProcessDesign(Long id); + + /** + * 获得工艺设计分页 + * + * @param pageReqVO 分页查询 + * @return 工艺设计分页 + */ + PageResult getProcessDesignPage(ProcessDesignPageReqVO pageReqVO); + + // ==================== 子表(工艺设计进度) ==================== + + /** + * 获得工艺设计进度列表 + * + * @param processDesignId 工艺设计id + * @return 工艺设计进度列表 + */ + List getProcessDesignProgressListByProcessDesignId(Long processDesignId); + + /** + * 获取预警信息 + * @return + */ + WarningMessageVO getWarnings(); +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignServiceImpl.java index 990abc99..59f94fe2 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processdesign/ProcessDesignServiceImpl.java @@ -1,112 +1,202 @@ -package com.chanko.yunxi.mes.module.heli.service.processdesign; - -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.processdesign.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; -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.processdesign.ProcessDesignMapper; -import com.chanko.yunxi.mes.module.heli.dal.mysql.processdesignprogress.ProcessDesignProgressMapper; - -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 ProcessDesignServiceImpl implements ProcessDesignService { - - @Resource - private ProcessDesignMapper processDesignMapper; - @Resource - private ProcessDesignProgressMapper processDesignProgressMapper; - - @Override - @Transactional(rollbackFor = Exception.class) - public Long createProcessDesign(ProcessDesignSaveReqVO createReqVO) { - // 插入 - ProcessDesignDO processDesign = BeanUtils.toBean(createReqVO, ProcessDesignDO.class); - processDesignMapper.insert(processDesign); - - // 插入子表 - createProcessDesignProgressList(processDesign.getId(), createReqVO.getProcessDesignProgresss()); - // 返回 - return processDesign.getId(); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void updateProcessDesign(ProcessDesignSaveReqVO updateReqVO) { - // 校验存在 - validateProcessDesignExists(updateReqVO.getId()); - // 更新 - ProcessDesignDO updateObj = BeanUtils.toBean(updateReqVO, ProcessDesignDO.class); - processDesignMapper.updateById(updateObj); - - // 更新子表 - updateProcessDesignProgressList(updateReqVO.getId(), updateReqVO.getProcessDesignProgresss()); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteProcessDesign(Long id) { - // 校验存在 - validateProcessDesignExists(id); - // 删除 - processDesignMapper.deleteById(id); - - // 删除子表 - deleteProcessDesignProgressByProcessDesignId(id); - } - - private void validateProcessDesignExists(Long id) { - if (processDesignMapper.selectById(id) == null) { - throw exception(PROCESS_DESIGN_NOT_EXISTS); - } - } - - @Override - public ProcessDesignDO getProcessDesign(Long id) { - return processDesignMapper.selectById(id); - } - - @Override - public PageResult getProcessDesignPage(ProcessDesignPageReqVO pageReqVO) { - return processDesignMapper.selectPage(pageReqVO); - } - - // ==================== 子表(工艺设计进度) ==================== - - @Override - public List getProcessDesignProgressListByProcessDesignId(Long processDesignId) { - return processDesignProgressMapper.selectListByProcessDesignId(processDesignId); - } - - private void createProcessDesignProgressList(Long processDesignId, List list) { - list.forEach(o -> o.setProcessDesignId(processDesignId)); - processDesignProgressMapper.insertBatch(list); - } - - private void updateProcessDesignProgressList(Long processDesignId, List list) { - deleteProcessDesignProgressByProcessDesignId(processDesignId); - list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 - createProcessDesignProgressList(processDesignId, list); - } - - private void deleteProcessDesignProgressByProcessDesignId(Long processDesignId) { - processDesignProgressMapper.deleteByProcessDesignId(processDesignId); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.processdesign; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import com.chanko.yunxi.mes.framework.security.core.util.SecurityFrameworkUtils; +import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.ProcessDesignPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.processdesign.vo.ProcessDesignSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesign.ProcessDesignDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.processdesignprogress.ProcessDesignProgressDO; +import com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign.ProcessDesignMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign.ProcessDesignProgressMapper; +import com.chanko.yunxi.mes.module.heli.enums.ProcessDesignTypeEnum; +import com.chanko.yunxi.mes.module.heli.enums.WarningEnum; +import com.chanko.yunxi.mes.module.heli.vo.WarningMessageVO; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.PROCESS_DESIGN_NOT_EXISTS; + +/** + * 工艺设计 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class ProcessDesignServiceImpl implements ProcessDesignService { + + @Resource + private ProcessDesignMapper processDesignMapper; + @Resource + private ProcessDesignProgressMapper processDesignProgressMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public Long createProcessDesign(ProcessDesignSaveReqVO createReqVO) { + // 插入 + ProcessDesignDO processDesign = BeanUtils.toBean(createReqVO, ProcessDesignDO.class); + processDesignMapper.insert(processDesign); + + // 插入子表 + if(createReqVO.getProcessDesignProgressList() != null && !createReqVO.getProcessDesignProgressList().isEmpty()) { + createProcessDesignProgressList(processDesign.getId(), createReqVO.getProcessDesignProgressList()); + } + + // 返回 + return processDesign.getId(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Long updateProcessDesign(ProcessDesignSaveReqVO updateReqVO) { + // 校验存在 + validateProcessDesignExists(updateReqVO.getId()); + // 更新 + ProcessDesignDO updateObj = BeanUtils.toBean(updateReqVO, ProcessDesignDO.class); + processDesignMapper.updateById(updateObj); + + // 更新子表 + updateProcessDesignProgressList(updateReqVO.getId(), updateReqVO.getProcessDesignProgressList()); + + return updateObj.getId(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteProcessDesign(Long id) { + // 校验存在 + validateProcessDesignExists(id); + // 删除 + processDesignMapper.deleteById(id); + + // 删除子表 + deleteProcessDesignProgressByProcessDesignId(id); + } + + private void validateProcessDesignExists(Long id) { + if (processDesignMapper.selectById(id) == null) { + throw exception(PROCESS_DESIGN_NOT_EXISTS); + } + } + + @Override + public ProcessDesignDO getProcessDesign(Long id) { + return processDesignMapper.selectById(id); + } + + @Override + public PageResult getProcessDesignPage(ProcessDesignPageReqVO pageReqVO) { + if(pageReqVO.getIsOverview()){ + PageResult processDesignDOPageResult = processDesignMapper.selectPageOverview(pageReqVO); + if(processDesignDOPageResult.getTotal() > 0){ + processDesignDOPageResult.getList().forEach(processDesignDO -> { + ProcessDesignPageReqVO reqVO = new ProcessDesignPageReqVO(); + reqVO.setProjectSubId(processDesignDO.getProjectSubId()) + .setProjectId(processDesignDO.getProjectId()) + .setProcessDesignTypeList(pageReqVO.getProcessDesignTypeList()); + PageResult detailResult = processDesignMapper.selectPage(reqVO); + if(detailResult.getTotal() > 0){ + detailResult.getList().forEach(processDesign -> { + if(ProcessDesignTypeEnum.BLUEPRINT_WORKBLANK.name().equals(processDesign.getProcessDesignType())){ + processDesignDO.setBlankDate(processDesign.getBlankDate()) + .setBlankOwnerName(processDesign.getBlankOwnerName()) + .setProgressBlank(processDesign.getProgress()); + }else if(ProcessDesignTypeEnum.BLUEPRINT_3D.name().equals(processDesign.getProcessDesignType())){ + processDesignDO.setThreeDimDate(processDesign.getThreeDimDate()) + .setThreeDimOwnerName(processDesign.getThreeDimOwnerName()) + .setProgress3d(processDesign.getProgress()); + }else if(ProcessDesignTypeEnum.BLUEPRINT_2D.name().equals(processDesign.getProcessDesignType())){ + processDesignDO.setTwoDimDate(processDesign.getTwoDimDate()) + .setTwoDimOwnerName(processDesign.getTwoDimOwnerName()) + .setProgress2d(processDesign.getProgress()); + } + }); + } + }); + } + return processDesignDOPageResult; + } + return processDesignMapper.selectPage(pageReqVO); + } + + // ==================== 子表(工艺设计进度) ==================== + + @Override + public List getProcessDesignProgressListByProcessDesignId(Long processDesignId) { + return processDesignProgressMapper.selectListByProcessDesignId(processDesignId); + } + + @Override + public WarningMessageVO getWarnings() { + WarningMessageVO warningMessageVO = new WarningMessageVO(); + warningMessageVO.setWarnings(new ArrayList<>(16)); + + Long userId = SecurityFrameworkUtils.getLoginUser().getId(); + ProcessDesignPageReqVO reqVO = new ProcessDesignPageReqVO(); + reqVO.setUncompletedDesign(true).setOwner(userId).setPageSize(99); + PageResult result = processDesignMapper.selectPage(reqVO); + if(result.getTotal() > 0){ + LocalDateTime now = LocalDateTime.now(); + result.getList().forEach(processDesign -> { + WarningMessageVO.ProcessDesignDeferredWarningVO warningVO = new WarningMessageVO.ProcessDesignDeferredWarningVO(); + warningVO.setWarningType(WarningEnum.PROCESS_DESIGN_DEFERRED_WARNING.name()) + .setProcessDesignType(processDesign.getProcessDesignType()) + .setProjectCode(processDesign.getProjectCode()) + .setProjectSubCode(processDesign.getProjectSubCode()); + + long betweenMills = 0; + String ownerName = ""; + if(ProcessDesignTypeEnum.BLUEPRINT_WORKBLANK.name().equals(processDesign.getProcessDesignType())){ + betweenMills = Duration.between(now, processDesign.getBlankDate()).toMillis(); + ownerName = processDesign.getBlankOwnerName(); + }else if(ProcessDesignTypeEnum.BLUEPRINT_3D.name().equals(processDesign.getProcessDesignType())){ + betweenMills = Duration.between(now, processDesign.getThreeDimDate()).toMillis(); + ownerName = processDesign.getThreeDimOwnerName(); + }else if(ProcessDesignTypeEnum.BLUEPRINT_2D.name().equals(processDesign.getProcessDesignType())){ + betweenMills = Duration.between(now, processDesign.getTwoDimDate()).toMillis(); + ownerName = processDesign.getTwoDimOwnerName(); + }else if (ProcessDesignTypeEnum.BLUEPRINT_FOUNDRY_TECHNOLOGY.name().equals(processDesign.getProcessDesignType())){ + betweenMills = Duration.between(now, processDesign.getCraftEndDate()).toMillis(); + ownerName = processDesign.getCraftOwnerName(); + } + + // 时差判断 48小时 + if(betweenMills <= 172800000){ + warningVO.setRemainingTime(betweenMills).setOwnerName(ownerName); + warningMessageVO.getWarnings().add(warningVO); + } + }); + } + + warningMessageVO.setHasWarning(!warningMessageVO.getWarnings().isEmpty()); + return warningMessageVO; + } + + private void createProcessDesignProgressList(Long processDesignId, List list) { + list.forEach(o -> o.setProcessDesignId(processDesignId)); + // 按创建时间排序 + list.sort(Comparator.comparing(ProcessDesignProgressDO::getCreateTime)); + processDesignProgressMapper.insertBatch(list); + } + + private void updateProcessDesignProgressList(Long processDesignId, List list) { + deleteProcessDesignProgressByProcessDesignId(processDesignId); + list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 + createProcessDesignProgressList(processDesignId, list); + } + + private void deleteProcessDesignProgressByProcessDesignId(Long processDesignId) { + processDesignProgressMapper.deleteByProcessDesignId(processDesignId); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java index 8ba43167..49107418 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java @@ -31,10 +31,7 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -113,6 +110,7 @@ public class ProjectOrderServiceImpl implements ProjectOrderService { ; projectOrderMapper.insert(projectOrder); // 子项目 + createReqVO.getProjectOrderSubs().forEach(projectOrderSubDO -> projectOrderSubDO.setId(null)); createProjectOrderSubList(projectOrder.getId(), createReqVO.getProjectOrderSubs()); // 附件 PageResult filePage = fileService.getFilePage(new FilePageReqVO() {{ @@ -259,9 +257,13 @@ public class ProjectOrderServiceImpl implements ProjectOrderService { Map> nameGroups = lastSnapshotSubDOList.stream().collect(Collectors.groupingBy(ProjectOrderSubDO::getName)); projectOrderSubDOList.forEach(projectOrderSubDO -> { List lastSnapshotSubs = nameGroups.get(projectOrderSubDO.getName()); - if(lastSnapshotSubs.isEmpty()) return; - List diffFields = FIELD_EQUATOR.getDiffFields(projectOrderSubDO, lastSnapshotSubs.get(0)); - projectOrderSubDO.setAlterFieldNames(diffFields.stream().map(FieldInfo::getFieldName).collect(Collectors.toSet())); + if(lastSnapshotSubs == null || lastSnapshotSubs.isEmpty()){ + // 如为新增行 则整行标记 + projectOrderSubDO.setAlterFieldNames(new HashSet(1){{add("NEW");}}); + }else{ + List diffFields = FIELD_EQUATOR.getDiffFields(projectOrderSubDO, lastSnapshotSubs.get(0)); + projectOrderSubDO.setAlterFieldNames(diffFields.stream().map(FieldInfo::getFieldName).collect(Collectors.toSet())); + } }); } }catch (Exception e){ @@ -283,13 +285,16 @@ public class ProjectOrderServiceImpl implements ProjectOrderService { } private void createProjectOrderSubList(Long projectOrderId, List list) { - list.forEach(o -> o.setId(null).setProjectOrderId(projectOrderId)); - projectOrderSubMapper.insertBatch(list); + list.forEach(o -> o.setProjectOrderId(projectOrderId)); + // 分组更新与插入 + List updateList = list.stream().filter(o -> o.getId() != null).collect(Collectors.toList()); + List insertList = list.stream().filter(o -> o.getId() == null).collect(Collectors.toList()); + + if(!updateList.isEmpty()) projectOrderSubMapper.updateBatch(updateList); + if(!insertList.isEmpty()) projectOrderSubMapper.insertBatch(insertList); } private void updateProjectOrderSubList(Long projectOrderId, List list) { - deleteProjectOrderSubByProjectOrderId(projectOrderId); - list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 createProjectOrderSubList(projectOrderId, list); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderService.java new file mode 100644 index 00000000..c97accf3 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderService.java @@ -0,0 +1,60 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseorder; + +import java.util.*; +import javax.validation.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 采购订单 Service 接口 + * + * @author 管理员 + */ +public interface PurchaseOrderService { + + /** + * 创建采购订单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPurchaseOrder(@Valid PurchaseOrderSaveReqVO createReqVO); + + /** + * 更新采购订单 + * + * @param updateReqVO 更新信息 + */ + void updatePurchaseOrder(@Valid PurchaseOrderSaveReqVO updateReqVO); + + /** + * 删除采购订单 + * + * @param id 编号 + */ + void deletePurchaseOrder(Long id); + + /** + * 获得采购订单 + * + * @param id 编号 + * @return 采购订单 + */ + PurchaseOrderDO getPurchaseOrder(Long id); + + /** + * 获得采购订单分页 + * + * @param pageReqVO 分页查询 + * @return 采购订单分页 + */ + PageResult getPurchaseOrderPage(PurchaseOrderPageReqVO pageReqVO); + PageResult getPurchaseOrderPageWithTax(PurchaseOrderPageReqVO pageReqVO); + + PageResult getPurchaseOrderPageByStatus(PurchaseOrderPageReqVO pageReqVO); +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderServiceImpl.java new file mode 100644 index 00000000..7fb62907 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderServiceImpl.java @@ -0,0 +1,112 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseorder; + +import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +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.time.LocalDateTime; +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +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.purchaseorder.PurchaseOrderMapper; + +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.PURCHASE_ORDER; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 采购订单 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class PurchaseOrderServiceImpl implements PurchaseOrderService { + + @Resource + private PurchaseOrderMapper purchaseOrderMapper; + + @Resource + private SerialNumberService serialNumberService; + + @Override + public Long createPurchaseOrder(PurchaseOrderSaveReqVO createReqVO) { + // 插入 + PurchaseOrderDO purchaseOrder = BeanUtils.toBean(createReqVO, PurchaseOrderDO.class); + + + // 月度流水号 + SerialNumberDO serialNumberDO = new SerialNumberDO(); + serialNumberDO = serialNumberService.getSerialNumber(PURCHASE_ORDER.name(), new SimpleDateFormat("yyyyMMdd").format(new Date())); + serialNumberDO.setSerialNumber(serialNumberDO.getSerialNumber()+1); + + purchaseOrder.setPurchaseNo(PURCHASE_ORDER.getCode(serialNumberDO.getSerialNumber().toString())); + purchaseOrderMapper.insert(purchaseOrder); + // 回写序列记录 + serialNumberService.updateSerialNumber(serialNumberDO); + // 返回 + return purchaseOrder.getId(); + } + + @Override + public void updatePurchaseOrder(PurchaseOrderSaveReqVO updateReqVO) { + // 校验存在 + validatePurchaseOrderExists(updateReqVO.getId()); + // 更新 + PurchaseOrderDO updateObj = BeanUtils.toBean(updateReqVO, PurchaseOrderDO.class); + + LocalDateTime currTime = LocalDateTime.now(); + if(updateReqVO.getStatus()==2){ + updateObj.setSubmitTime(currTime); + } + if(updateReqVO.getStatus()== 3 || updateReqVO.getStatus() == 4){ + updateObj.setAuditTime(currTime); + } + purchaseOrderMapper.updateById(updateObj); + } + + @Override + public void deletePurchaseOrder(Long id) { + // 校验存在 + validatePurchaseOrderExists(id); + // 删除 + purchaseOrderMapper.deleteById(id); + } + + private void validatePurchaseOrderExists(Long id) { + if (purchaseOrderMapper.selectById(id) == null) { + throw exception(PURCHASE_ORDER_NOT_EXISTS); + } + } + + @Override + public PurchaseOrderDO getPurchaseOrder(Long id) { + return purchaseOrderMapper.selectById(id); + } + + @Override + public PageResult getPurchaseOrderPage(PurchaseOrderPageReqVO pageReqVO) { + return purchaseOrderMapper.selectPage(pageReqVO); + } + + @Override + public PageResult getPurchaseOrderPageWithTax(PurchaseOrderPageReqVO pageReqVO) { + return purchaseOrderMapper.selectListWithTax(pageReqVO); + } + + @Override + public PageResult getPurchaseOrderPageByStatus(PurchaseOrderPageReqVO pageReqVO) { + return purchaseOrderMapper.selectPageByStatus(pageReqVO); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialService.java new file mode 100644 index 00000000..c2e75dbd --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseordermaterial; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 采购单物料 Service 接口 + * + * @author 管理员 + */ +public interface PurchaseOrderMaterialService { + + /** + * 创建采购单物料 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPurchaseOrderMaterial(@Valid PurchaseOrderMaterialSaveReqVO createReqVO); + + /** + * 更新采购单物料 + * + * @param updateReqVO 更新信息 + */ + void updatePurchaseOrderMaterial(@Valid PurchaseOrderMaterialSaveReqVO updateReqVO); + + /** + * 删除采购单物料 + * + * @param id 编号 + */ + void deletePurchaseOrderMaterial(Long id); + + /** + * 获得采购单物料 + * + * @param id 编号 + * @return 采购单物料 + */ + PurchaseOrderMaterialDO getPurchaseOrderMaterial(Long id); + + /** + * 获得采购单物料分页 + * + * @param pageReqVO 分页查询 + * @return 采购单物料分页 + */ + PageResult getPurchaseOrderMaterialPage(PurchaseOrderMaterialPageReqVO 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/purchaseordermaterial/PurchaseOrderMaterialServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialServiceImpl.java new file mode 100644 index 00000000..bf2363ad --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialServiceImpl.java @@ -0,0 +1,74 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseordermaterial; + +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.purchaseordermaterial.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +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.purchaseordermaterial.PurchaseOrderMaterialMapper; + +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 PurchaseOrderMaterialServiceImpl implements PurchaseOrderMaterialService { + + @Resource + private PurchaseOrderMaterialMapper purchaseOrderMaterialMapper; + + @Override + public Long createPurchaseOrderMaterial(PurchaseOrderMaterialSaveReqVO createReqVO) { + // 插入 + PurchaseOrderMaterialDO purchaseOrderMaterial = BeanUtils.toBean(createReqVO, PurchaseOrderMaterialDO.class); + purchaseOrderMaterialMapper.insert(purchaseOrderMaterial); + // 返回 + return purchaseOrderMaterial.getId(); + } + + @Override + public void updatePurchaseOrderMaterial(PurchaseOrderMaterialSaveReqVO updateReqVO) { + // 校验存在 + validatePurchaseOrderMaterialExists(updateReqVO.getId()); + // 更新 + PurchaseOrderMaterialDO updateObj = BeanUtils.toBean(updateReqVO, PurchaseOrderMaterialDO.class); + purchaseOrderMaterialMapper.updateById(updateObj); + } + + @Override + public void deletePurchaseOrderMaterial(Long id) { + // 校验存在 + validatePurchaseOrderMaterialExists(id); + // 删除 + purchaseOrderMaterialMapper.deleteById(id); + } + + private void validatePurchaseOrderMaterialExists(Long id) { + if (purchaseOrderMaterialMapper.selectById(id) == null) { + throw exception(PURCHASE_ORDER_MATERIAL_NOT_EXISTS); + } + } + + @Override + public PurchaseOrderMaterialDO getPurchaseOrderMaterial(Long id) { + return purchaseOrderMaterialMapper.selectById(id); + } + + @Override + public PageResult getPurchaseOrderMaterialPage(PurchaseOrderMaterialPageReqVO pageReqVO) { + return purchaseOrderMaterialMapper.selectPage(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/supplier/SupplierService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierService.java index 23725a77..f81a3fcd 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierService.java @@ -1,55 +1,59 @@ -package com.chanko.yunxi.mes.module.heli.service.supplier; - -import java.util.*; -import javax.validation.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; - -/** - * 供应商 Service 接口 - * - * @author 管理员 - */ -public interface SupplierService { - - /** - * 创建供应商 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createSupplier(@Valid SupplierSaveReqVO createReqVO); - - /** - * 更新供应商 - * - * @param updateReqVO 更新信息 - */ - void updateSupplier(@Valid SupplierSaveReqVO updateReqVO); - - /** - * 删除供应商 - * - * @param id 编号 - */ - void deleteSupplier(Long id); - - /** - * 获得供应商 - * - * @param id 编号 - * @return 供应商 - */ - SupplierDO getSupplier(Long id); - - /** - * 获得供应商分页 - * - * @param pageReqVO 分页查询 - * @return 供应商分页 - */ - PageResult getSupplierPage(SupplierPageReqVO pageReqVO); - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.supplier; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 供应商 Service 接口 + * + * @author 管理员 + */ +public interface SupplierService { + + /** + * 创建供应商 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSupplier(@Valid SupplierSaveReqVO createReqVO); + + /** + * 更新供应商 + * + * @param updateReqVO 更新信息 + */ + void updateSupplier(@Valid SupplierSaveReqVO updateReqVO); + + /** + * 删除供应商 + * + * @param id 编号 + */ + void deleteSupplier(Long id); + + /** + * 获得供应商 + * + * @param id 编号 + * @return 供应商 + */ + SupplierDO getSupplier(Long id); + + /** + * 获得供应商分页 + * + * @param pageReqVO 分页查询 + * @return 供应商分页 + */ + PageResult getSupplierPage(SupplierPageReqVO pageReqVO); + + List> getSimpleList(); + + List> getSimpleNoStatusList(); + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java index 4354cd1c..a38221ae 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java @@ -90,4 +90,14 @@ public class SupplierServiceImpl implements SupplierService { throw exception(CODE_REPEAT); } } + + @Override + public List> getSimpleList() { + return supplierMapper.selectSimpleList(); + } + + @Override + public List> getSimpleNoStatusList() { + return supplierMapper.selectSimpleNoStatusList(); + } } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchService.java new file mode 100644 index 00000000..2ca2f48a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchService.java @@ -0,0 +1,66 @@ +package com.chanko.yunxi.mes.module.heli.service.taskdispatch; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.taskdispatch.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatchdetail.TaskDispatchDetailDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 派工单 Service 接口 + * + * @author 管理员 + */ +public interface TaskDispatchService { + + /** + * 创建派工单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createTaskDispatch(@Valid TaskDispatchSaveReqVO createReqVO); + + /** + * 更新派工单 + * + * @param updateReqVO 更新信息 + */ + void updateTaskDispatch(@Valid TaskDispatchSaveReqVO updateReqVO); + + /** + * 删除派工单 + * + * @param id 编号 + */ + void deleteTaskDispatch(Long id); + + /** + * 获得派工单 + * + * @param id 编号 + * @return 派工单 + */ + TaskDispatchDO getTaskDispatch(Long id); + + /** + * 获得派工单分页 + * + * @param pageReqVO 分页查询 + * @return 派工单分页 + */ + PageResult getTaskDispatchPage(TaskDispatchPageReqVO pageReqVO); + + // ==================== 子表(派工明细) ==================== + + /** + * 获得派工明细列表 + * + * @param dispatchId 派工单id + * @return 派工明细列表 + */ + List getTaskDispatchDetailListByDispatchId(Long dispatchId); + +} \ 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/taskdispatch/TaskDispatchServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchServiceImpl.java new file mode 100644 index 00000000..56c0ed3b --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchServiceImpl.java @@ -0,0 +1,112 @@ +package com.chanko.yunxi.mes.module.heli.service.taskdispatch; + +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.taskdispatch.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatchdetail.TaskDispatchDetailDO; +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.taskdispatch.TaskDispatchMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.taskdispatchdetail.TaskDispatchDetailMapper; + +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 TaskDispatchServiceImpl implements TaskDispatchService { + + @Resource + private TaskDispatchMapper taskDispatchMapper; + @Resource + private TaskDispatchDetailMapper taskDispatchDetailMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public Long createTaskDispatch(TaskDispatchSaveReqVO createReqVO) { + // 插入 + TaskDispatchDO taskDispatch = BeanUtils.toBean(createReqVO, TaskDispatchDO.class); + taskDispatchMapper.insert(taskDispatch); + + // 插入子表 + createTaskDispatchDetailList(taskDispatch.getId(), createReqVO.getTaskDispatchDetails()); + // 返回 + return taskDispatch.getId(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateTaskDispatch(TaskDispatchSaveReqVO updateReqVO) { + // 校验存在 + validateTaskDispatchExists(updateReqVO.getId()); + // 更新 + TaskDispatchDO updateObj = BeanUtils.toBean(updateReqVO, TaskDispatchDO.class); + taskDispatchMapper.updateById(updateObj); + + // 更新子表 + updateTaskDispatchDetailList(updateReqVO.getId(), updateReqVO.getTaskDispatchDetails()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteTaskDispatch(Long id) { + // 校验存在 + validateTaskDispatchExists(id); + // 删除 + taskDispatchMapper.deleteById(id); + + // 删除子表 + deleteTaskDispatchDetailByDispatchId(id); + } + + private void validateTaskDispatchExists(Long id) { + if (taskDispatchMapper.selectById(id) == null) { + throw exception(TASK_DISPATCH_NOT_EXISTS); + } + } + + @Override + public TaskDispatchDO getTaskDispatch(Long id) { + return taskDispatchMapper.selectById(id); + } + + @Override + public PageResult getTaskDispatchPage(TaskDispatchPageReqVO pageReqVO) { + return taskDispatchMapper.selectPage(pageReqVO); + } + + // ==================== 子表(派工明细) ==================== + + @Override + public List getTaskDispatchDetailListByDispatchId(Long dispatchId) { + return taskDispatchDetailMapper.selectListByDispatchId(dispatchId); + } + + private void createTaskDispatchDetailList(Long dispatchId, List list) { + list.forEach(o -> o.setDispatchId(dispatchId)); + taskDispatchDetailMapper.insertBatch(list); + } + + private void updateTaskDispatchDetailList(Long dispatchId, List list) { + deleteTaskDispatchDetailByDispatchId(dispatchId); + list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 + createTaskDispatchDetailList(dispatchId, list); + } + + private void deleteTaskDispatchDetailByDispatchId(Long dispatchId) { + taskDispatchDetailMapper.deleteByDispatchId(dispatchId); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/materialplan/MaterialPlanMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/materialplan/MaterialPlanMapper.xml new file mode 100644 index 00000000..0e4fd5e2 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/materialplan/MaterialPlanMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/materialplandetail/MaterialPlanDetailMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/materialplandetail/MaterialPlanDetailMapper.xml new file mode 100644 index 00000000..1df22a9c --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/materialplandetail/MaterialPlanDetailMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/plan/PlanMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/plan/PlanMapper.xml new file mode 100644 index 00000000..6992dd72 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/plan/PlanMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/plansub/PlanSubMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/plansub/PlanSubMapper.xml new file mode 100644 index 00000000..527ab29d --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/plansub/PlanSubMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/processbom/ProcessBomMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/processbom/ProcessBomMapper.xml new file mode 100644 index 00000000..eac1ad47 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/processbom/ProcessBomMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseorder/PurchaseOrderMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseorder/PurchaseOrderMapper.xml new file mode 100644 index 00000000..a0ceec40 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseorder/PurchaseOrderMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseordermaterial/PurchaseOrderMaterialMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseordermaterial/PurchaseOrderMaterialMapper.xml new file mode 100644 index 00000000..fd478fa7 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseordermaterial/PurchaseOrderMaterialMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/taskdispatch/TaskDispatchMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/taskdispatch/TaskDispatchMapper.xml new file mode 100644 index 00000000..2318da54 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/taskdispatch/TaskDispatchMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java index 365a4390..46d56aec 100644 --- a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java +++ b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java @@ -36,7 +36,7 @@ public interface AdminUserMapper extends BaseMapperX { .inIfPresent(AdminUserDO::getDeptId, deptIds) .orderByDesc(AdminUserDO::getId); if(!StringUtils.isEmpty(reqVO.getUserNickName())){ - query.like(AdminUserDO::getUsername, reqVO.getUserNickName()).or().like(AdminUserDO::getNickname, reqVO.getUserNickName()); + query.and(QueryWrapper -> QueryWrapper.like(AdminUserDO::getUsername, reqVO.getUserNickName()).or().like(AdminUserDO::getNickname, reqVO.getUserNickName())); } return selectPage(reqVO, query); } diff --git a/mes-ui/mes-ui-admin-vue3/.image/src/api/heli/plan/index.ts b/mes-ui/mes-ui-admin-vue3/.image/src/api/heli/plan/index.ts new file mode 100644 index 00000000..b13a018f --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/.image/src/api/heli/plan/index.ts @@ -0,0 +1,52 @@ +import request from '@/config/axios' + +export interface PlanVO { + id: number + planNo: string + projectId: number + projectOwner: string + hasCraft: number + craftOwner: string + craftStartDate: Date + craftEndDate: Date + craftContent: string + editor: string + editorDate: Date + auditor: string + auditDate: Date + approver: string + approveDate: Date + description: string + status: boolean + changeNum: number +} + +// 查询生产计划分页 +export const getPlanPage = async (params) => { + return await request.get({ url: `/heli/plan/page`, params }) +} + +// 查询生产计划详情 +export const getPlan = async (id: number) => { + return await request.get({ url: `/heli/plan/get?id=` + id }) +} + +// 新增生产计划 +export const createPlan = async (data: PlanVO) => { + return await request.post({ url: `/heli/plan/create`, data }) +} + +// 修改生产计划 +export const updatePlan = async (data: PlanVO) => { + return await request.put({ url: `/heli/plan/update`, data }) +} + +// 删除生产计划 +export const deletePlan = async (id: number) => { + return await request.delete({ url: `/heli/plan/delete?id=` + id }) +} + +// 导出生产计划 Excel +export const exportPlan = async (params) => { + return await request.download({ url: `/heli/plan/export-excel`, params }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/.image/src/views/heli/plan/PlanForm.vue b/mes-ui/mes-ui-admin-vue3/.image/src/views/heli/plan/PlanForm.vue new file mode 100644 index 00000000..265ee783 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/.image/src/views/heli/plan/PlanForm.vue @@ -0,0 +1,206 @@ + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/.image/src/views/heli/plan/index.vue b/mes-ui/mes-ui-admin-vue3/.image/src/views/heli/plan/index.vue new file mode 100644 index 00000000..7c686d79 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/.image/src/views/heli/plan/index.vue @@ -0,0 +1,405 @@ + + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/package.json b/mes-ui/mes-ui-admin-vue3/package.json index ffc07e52..851e4db6 100644 --- a/mes-ui/mes-ui-admin-vue3/package.json +++ b/mes-ui/mes-ui-admin-vue3/package.json @@ -56,6 +56,7 @@ "mitt": "^3.0.1", "nprogress": "^0.2.0", "pinia": "^2.1.7", + "pinia-plugin-persist": "^1.0.0", "qrcode": "^1.5.3", "qs": "^6.11.2", "sortablejs": "^1.15.0", @@ -86,8 +87,8 @@ "@types/sortablejs": "^1.15.5", "@typescript-eslint/eslint-plugin": "^6.11.0", "@typescript-eslint/parser": "^6.11.0", - "@unocss/transformer-variant-group": "^0.57.4", "@unocss/eslint-config": "^0.57.4", + "@unocss/transformer-variant-group": "^0.57.4", "@vitejs/plugin-legacy": "^4.1.1", "@vitejs/plugin-vue": "^4.4.1", "@vitejs/plugin-vue-jsx": "^3.0.2", diff --git a/mes-ui/mes-ui-admin-vue3/src/api/crm/customer/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/crm/customer/index.ts index 5ef43950..dca9e6f9 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/crm/customer/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/crm/customer/index.ts @@ -31,6 +31,7 @@ export interface CustomerVO { updateTime?: Date creator?: string creatorName?: string + briefOrName: string } // 查询客户列表 diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/customer/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/customer/index.ts index e1826525..cdee2490 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/customer/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/customer/index.ts @@ -5,6 +5,7 @@ export interface CustomerVO { code: string brief: string name: string + briefOrName:string industry: string level: number userId: string diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/equip/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/equip/index.ts index d5768c97..a8061ced 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/equip/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/equip/index.ts @@ -6,6 +6,15 @@ export interface EquipVO { mouldTypeId: number status: number } +// 查询设备信息全页数据 +export const getNoStatusSimpList = async () => { + return await request.get({ url: `/heli/equip/all-no-status-simples` }) +} + +// 查询设备信息全页数据 +export const getSimpList = async () => { + return await request.get({ url: `/heli/equip/all-simples` }) +} // 查询设备信息分页 export const getEquipPage = async (params) => { diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/material/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/material/index.ts index 8360586f..e7bd9a88 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/material/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/material/index.ts @@ -4,6 +4,7 @@ export interface MaterialVO { id: number code: string name: string + codeAndName:string brand: string spec: string sizeInfo: string diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/materialplan/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/materialplan/index.ts new file mode 100644 index 00000000..af2de459 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/materialplan/index.ts @@ -0,0 +1,44 @@ +import request from '@/config/axios' + +export interface MaterialPlanVO { + id: number + projectMaterialPlanNo: string + projectId: number + projectPlanId: number + submitUserId: number + submitTime: Date + auditor: number + auditTime: Date + status: number + description: string +} + +// 查询物料需求计划分页 +export const getMaterialPlanPage = async (params) => { + return await request.get({ url: `/heli/material-plan/page`, params }) +} + +// 查询物料需求计划详情 +export const getMaterialPlan = async (id: number) => { + return await request.get({ url: `/heli/material-plan/get?id=` + id }) +} + +// 新增物料需求计划 +export const createMaterialPlan = async (data: MaterialPlanVO) => { + return await request.post({ url: `/heli/material-plan/create`, data }) +} + +// 修改物料需求计划 +export const updateMaterialPlan = async (data: MaterialPlanVO) => { + return await request.put({ url: `/heli/material-plan/update`, data }) +} + +// 删除物料需求计划 +export const deleteMaterialPlan = async (id: number) => { + return await request.delete({ url: `/heli/material-plan/delete?id=` + id }) +} + +// 导出物料需求计划 Excel +export const exportMaterialPlan = async (params) => { + return await request.download({ url: `/heli/material-plan/export-excel`, params }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/materialplandetail/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/materialplandetail/index.ts new file mode 100644 index 00000000..63680ab3 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/materialplandetail/index.ts @@ -0,0 +1,41 @@ +import request from '@/config/axios' + +export interface MaterialPlanDetailVO { + id: number + projectMaterialPlanId: number + materialId: number + projectSubId: number + requireAmount: number + requireArriveTime: Date + description: string +} + +// 查询物料需求计划物料详情分页 +export const getMaterialPlanDetailPage = async (params) => { + return await request.get({ url: `/heli/material-plan-detail/page`, params }) +} + +// 查询物料需求计划物料详情详情 +export const getMaterialPlanDetail = async (id: number) => { + return await request.get({ url: `/heli/material-plan-detail/get?id=` + id }) +} + +// 新增物料需求计划物料详情 +export const createMaterialPlanDetail = async (data: MaterialPlanDetailVO) => { + return await request.post({ url: `/heli/material-plan-detail/create`, data }) +} + +// 修改物料需求计划物料详情 +export const updateMaterialPlanDetail = async (data: MaterialPlanDetailVO) => { + return await request.put({ url: `/heli/material-plan-detail/update`, data }) +} + +// 删除物料需求计划物料详情 +export const deleteMaterialPlanDetail = async (id: number) => { + return await request.delete({ url: `/heli/material-plan-detail/delete?id=` + id }) +} + +// 导出物料需求计划物料详情 Excel +export const exportMaterialPlanDetail = async (params) => { + return await request.download({ url: `/heli/material-plan-detail/export-excel`, params }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/mouldtype/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/mouldtype/index.ts index dd43ee4c..2ffe886a 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/mouldtype/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/mouldtype/index.ts @@ -5,7 +5,10 @@ export interface MouldTypeVO { name: string status: number } - +// 查询模具类型全页数据 +export const getNoStatusSimpList = async () => { + return await request.get({ url: `/heli/mould-type/all-no-status-simples` }) +} // 查询模具类型全页数据 export const getSimpList = async () => { return await request.get({ url: `/heli/mould-type/all-simples` }) 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 new file mode 100644 index 00000000..e2ada117 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/plan/index.ts @@ -0,0 +1,56 @@ +import request from '@/config/axios' + +export interface PlanVO { + id: number + planNo: string + projectId: number + projectOwner: string + hasCraft: boolean + craftOwner: string + craftStartDate: Date + craftEndDate: Date + craftContent: string + editor: string + editorDate: Date + auditor: string + auditDate: Date + approver: string + approveDate: Date + description: string + 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 }) +} + +// 查询生产计划详情 +export const getPlan = async (id: number) => { + return await request.get({ url: `/heli/plan/get?id=` + id }) +} + +// 新增生产计划 +export const createPlan = async (data: PlanVO) => { + return await request.post({ url: `/heli/plan/create`, data }) +} + +// 修改生产计划 +export const updatePlan = async (data: PlanVO) => { + return await request.put({ url: `/heli/plan/update`, data }) +} + +// 删除生产计划 +export const deletePlan = async (id: number) => { + return await request.delete({ url: `/heli/plan/delete?id=` + id }) +} + +// 导出生产计划 Excel +export const exportPlan = async (params) => { + return await request.download({ url: `/heli/plan/export-excel`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/plansub/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/plansub/index.ts new file mode 100644 index 00000000..0b882508 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/plansub/index.ts @@ -0,0 +1,48 @@ +import request from '@/config/axios' + +export interface PlanSubVO { + id: number + projectPlanId: number + projectId: number + projectSubId: number + projectSubShortName: string + projectSubCode: string + mouldId: number + equipId: number + blankDate: Date + blankOwner: string + twoDimDate: Date + twoDimOwner: string + threeDimDate: Date + threeDimOwner: string +} + +// 查询生产计划子项目分页 +export const getPlanSubPage = async (params) => { + return await request.get({ url: `/heli/plan-sub/page`, params }) +} + +// 查询生产计划子项目详情 +export const getPlanSub = async (id: number) => { + return await request.get({ url: `/heli/plan-sub/get?id=` + id }) +} + +// 新增生产计划子项目 +export const createPlanSub = async (data: PlanSubVO) => { + return await request.post({ url: `/heli/plan-sub/create`, data }) +} + +// 修改生产计划子项目 +export const updatePlanSub = async (data: PlanSubVO) => { + return await request.put({ url: `/heli/plan-sub/update`, data }) +} + +// 删除生产计划子项目 +export const deletePlanSub = async (id: number) => { + return await request.delete({ url: `/heli/plan-sub/delete?id=` + id }) +} + +// 导出生产计划子项目 Excel +export const exportPlanSub = async (params) => { + return await request.download({ url: `/heli/plan-sub/export-excel`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/processbom/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/processbom/index.ts new file mode 100644 index 00000000..298259a5 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/processbom/index.ts @@ -0,0 +1,58 @@ +import request from '@/config/axios' + +export interface ProcessBomVO { + id: number + code: string + planId: number + projectId: number + projectSubId: number + projectSubName: string + projectSubCode: string + version: number + bomStatus: number + remark: string + status: number + active: string + activeOpinion: string +} + +// 查询工艺bom分页 +export const getProcessBomPage = async (params) => { + return await request.get({ url: `/heli/process-bom/page`, params }) +} + +// 查询工艺bom详情 +export const getProcessBom = async (id: number) => { + return await request.get({ url: `/heli/process-bom/get?id=` + id }) +} + +// 新增工艺bom +export const createProcessBom = async (data: ProcessBomVO) => { + return await request.post({ url: `/heli/process-bom/create`, data }) +} + +// 修改工艺bom +export const updateProcessBom = async (data: ProcessBomVO) => { + return await request.put({ url: `/heli/process-bom/update`, data }) +} + +// 删除工艺bom +export const deleteProcessBom = async (id: number) => { + return await request.delete({ url: `/heli/process-bom/delete?id=` + id }) +} + +// 导出工艺bom Excel +export const exportProcessBom = async (params) => { + return await request.download({ url: `/heli/process-bom/export-excel`, params }) +} + +// ==================== 子表(工艺bom明细) ==================== + +// 获得工艺bom明细列表 +export const getProcessBomDetailListByBomId = async (bomId) => { + return await request.get({ url: `/heli/process-bom/process-bom-detail/list-by-bom-id?bomId=` + bomId }) +} + +export async function operateProcessBom(data: ProcessBomVO) { + return await request.post({ url: `/heli/process-bom/operate`, data }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/processdesign/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/processdesign/index.ts index 5feae98d..7a67aff9 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/processdesign/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/processdesign/index.ts @@ -1,48 +1,54 @@ -import request from '@/config/axios' - -export interface ProcessDesignVO { - id: number - planId: number - saleOrderId: number - saleOrderSubId: number - processDesignType: string - remark: string - status: number -} - -// 查询工艺设计分页 -export const getProcessDesignPage = async (params) => { - return await request.get({ url: `/heli/process-design/page`, params }) -} - -// 查询工艺设计详情 -export const getProcessDesign = async (id: number) => { - return await request.get({ url: `/heli/process-design/get?id=` + id }) -} - -// 新增工艺设计 -export const createProcessDesign = async (data: ProcessDesignVO) => { - return await request.post({ url: `/heli/process-design/create`, data }) -} - -// 修改工艺设计 -export const updateProcessDesign = async (data: ProcessDesignVO) => { - return await request.put({ url: `/heli/process-design/update`, data }) -} - -// 删除工艺设计 -export const deleteProcessDesign = async (id: number) => { - return await request.delete({ url: `/heli/process-design/delete?id=` + id }) -} - -// 导出工艺设计 Excel -export const exportProcessDesign = async (params) => { - return await request.download({ url: `/heli/process-design/export-excel`, params }) -} - -// ==================== 子表(工艺设计进度) ==================== - -// 获得工艺设计进度列表 -export const getProcessDesignProgressListByProcessDesignId = async (processDesignId) => { - return await request.get({ url: `/heli/process-design/process-design-progress/list-by-process-design-id?processDesignId=` + processDesignId }) -} \ No newline at end of file +import request from '@/config/axios' + +export interface ProcessDesignVO { + id: number + planId: number + processDesignType: string + remark: string + status: number + projectId: number + projectSubId: number + processDesignProgressList: any +} + +// 查询工艺设计分页 +export const getProcessDesignPage = async (params) => { + return await request.get({ url: `/heli/process-design/page`, params }) +} + +// 查询工艺设计详情 +export const getProcessDesign = async (id: number) => { + return await request.get({ url: `/heli/process-design/get?id=` + id }) +} + +// 新增工艺设计 +export const createProcessDesign = async (data: ProcessDesignVO) => { + return await request.post({ url: `/heli/process-design/create`, data }) +} + +// 修改工艺设计 +export const updateProcessDesign = async (data: ProcessDesignVO) => { + return await request.put({ url: `/heli/process-design/update`, data }) +} + +// 删除工艺设计 +export const deleteProcessDesign = async (id: number) => { + return await request.delete({ url: `/heli/process-design/delete?id=` + id }) +} + +// 导出工艺设计 Excel +export const exportProcessDesign = async (params) => { + return await request.download({ url: `/heli/process-design/export-excel`, params }) +} + +// ==================== 子表(工艺设计进度) ==================== + +// 获得工艺设计进度列表 +export const getProcessDesignProgressListByProcessDesignId = async (processDesignId) => { + return await request.get({ url: `/heli/process-design/process-design-progress/list-by-process-design-id?processDesignId=` + processDesignId }) +} + +// 查询工艺设计延期预警信息 +export const getProcessDesignDeferredWarning = async () => { + return await request.get({ url: `/heli/process-design/warnings`}) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseorder/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseorder/index.ts new file mode 100644 index 00000000..45aeb15c --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseorder/index.ts @@ -0,0 +1,60 @@ +import request from '@/config/axios' + +export interface PurchaseOrderVO { + id: number + purchaseNo: string + supplierId: number + contractNo: string + purchaseType: number + projectMaterialPlanId: number + goodsType: number + currencyType: number + taxRatio: number + estimatedPrice: number + actualPrice: number + status: boolean + submitUserId: number + submitTime: Date + auditor: number + auditTime: Date + description: string +} + +// 查询采购订单分页 +export const getPurchaseOrderPageByStatus = async (params) => { + return await request.get({ url: `/heli/purchase-order/page-by-status`, params }) +} +// 查询采购订单分页 +export const getPurchaseOrderPage = async (params) => { + return await request.get({ url: `/heli/purchase-order/page`, params }) +} + +// 查询采购订单详情 +export const getPurchaseOrder = async (id: number) => { + return await request.get({ url: `/heli/purchase-order/get?id=` + id }) +} + +// 新增采购订单 +export const createPurchaseOrder = async (data: PurchaseOrderVO) => { + return await request.post({ url: `/heli/purchase-order/create`, data }) +} + +// 修改采购订单 +export const updatePurchaseOrder = async (data: PurchaseOrderVO) => { + return await request.put({ url: `/heli/purchase-order/update`, data }) +} + +// 删除采购订单 +export const deletePurchaseOrder = async (id: number) => { + return await request.delete({ url: `/heli/purchase-order/delete?id=` + id }) +} + +// 导出采购订单 Excel +export const exportPurchaseOrder = async (params) => { + return await request.download({ url: `/heli/purchase-order/export-excel`, params }) +} + +// 导出采购订单 Excel +export const exportPurchaseOrderWithTax = async (params) => { + return await request.download({ url: `/heli/purchase-order/export-excel-with-tax`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseordermaterial/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseordermaterial/index.ts new file mode 100644 index 00000000..4244b9c6 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseordermaterial/index.ts @@ -0,0 +1,42 @@ +import request from '@/config/axios' + +export interface PurchaseOrderMaterialVO { + id: number + purchaseOrderId: number + materialId: number + purchaseAmount: number + estimatedPrice: number + actualPrice: number + arriveTime: Date + description: string +} + +// 查询采购单物料分页 +export const getPurchaseOrderMaterialPage = async (params) => { + return await request.get({ url: `/heli/purchase-order-material/page`, params }) +} + +// 查询采购单物料详情 +export const getPurchaseOrderMaterial = async (id: number) => { + return await request.get({ url: `/heli/purchase-order-material/get?id=` + id }) +} + +// 新增采购单物料 +export const createPurchaseOrderMaterial = async (data: PurchaseOrderMaterialVO) => { + return await request.post({ url: `/heli/purchase-order-material/create`, data }) +} + +// 修改采购单物料 +export const updatePurchaseOrderMaterial = async (data: PurchaseOrderMaterialVO) => { + return await request.put({ url: `/heli/purchase-order-material/update`, data }) +} + +// 删除采购单物料 +export const deletePurchaseOrderMaterial = async (id: number) => { + return await request.delete({ url: `/heli/purchase-order-material/delete?id=` + id }) +} + +// 导出采购单物料 Excel +export const exportPurchaseOrderMaterial = async (params) => { + return await request.download({ url: `/heli/purchase-order-material/export-excel`, params }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts index 2d77ffab..4b09ae8f 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts @@ -1,65 +1,72 @@ -import request from '@/config/axios' - -export interface SupplierVO { - id: number - code: string - brief: string - name: string - industry: string - level: number - category: number - userId: number - description: string - contact1Name: string - contact1Post: string - contact1Method: string - contact1Email: string - contact1Addr: string - contact2Name: string - contact2Post: string - contact2Method: string - contact2Email: string - contact2Addr: string - contact3Name: string - contact3Post: string - contact3Method: string - contact3Email: string - contact3Addr: string - status: number - logo: string - payType: string - accountName: string - bankNo: string - bankAddress: string - taxNo: string -} - -// 查询供应商分页 -export const getSupplierPage = async (params) => { - return await request.get({ url: `/heli/supplier/page`, params }) -} - -// 查询供应商详情 -export const getSupplier = async (id: number) => { - return await request.get({ url: `/heli/supplier/get?id=` + id }) -} - -// 新增供应商 -export const createSupplier = async (data: SupplierVO) => { - return await request.post({ url: `/heli/supplier/create`, data }) -} - -// 修改供应商 -export const updateSupplier = async (data: SupplierVO) => { - return await request.put({ url: `/heli/supplier/update`, data }) -} - -// 删除供应商 -export const deleteSupplier = async (id: number) => { - return await request.delete({ url: `/heli/supplier/delete?id=` + id }) -} - -// 导出供应商 Excel -export const exportSupplier = async (params) => { - return await request.download({ url: `/heli/supplier/export-excel`, params }) -} \ No newline at end of file +import request from '@/config/axios' + +export interface SupplierVO { + id: number + code: string + brief: string + name: string + industry: string + level: number + category: number + userId: number + description: string + contact1Name: string + contact1Post: string + contact1Method: string + contact1Email: string + contact1Addr: string + contact2Name: string + contact2Post: string + contact2Method: string + contact2Email: string + contact2Addr: string + contact3Name: string + contact3Post: string + contact3Method: string + contact3Email: string + contact3Addr: string + status: number + logo: string + payType: string + accountName: string + bankNo: string + bankAddress: string + taxNo: string +} +// 查询仓库分页 +export const getSimpNoStatusList = async () => { + return await request.get({ url: `/heli/supplier/all-no-status-simples` }) +} +// 查询仓库分页 +export const getSimpList = async () => { + return await request.get({ url: `/heli/supplier/all-simples` }) +} +// 查询供应商分页 +export const getSupplierPage = async (params) => { + return await request.get({ url: `/heli/supplier/page`, params }) +} + +// 查询供应商详情 +export const getSupplier = async (id: number) => { + return await request.get({ url: `/heli/supplier/get?id=` + id }) +} + +// 新增供应商 +export const createSupplier = async (data: SupplierVO) => { + return await request.post({ url: `/heli/supplier/create`, data }) +} + +// 修改供应商 +export const updateSupplier = async (data: SupplierVO) => { + return await request.put({ url: `/heli/supplier/update`, data }) +} + +// 删除供应商 +export const deleteSupplier = async (id: number) => { + return await request.delete({ url: `/heli/supplier/delete?id=` + id }) +} + +// 导出供应商 Excel +export const exportSupplier = async (params) => { + return await request.download({ url: `/heli/supplier/export-excel`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/taskdispatch/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/taskdispatch/index.ts new file mode 100644 index 00000000..28ce2580 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/taskdispatch/index.ts @@ -0,0 +1,52 @@ +import request from '@/config/axios' + +export interface TaskDispatchVO { + id: number + code: string + dispatchType: string + taskId: number + planId: number + projectId: number + projectSubId: number + bomDetailId: number + dispatchStatus: number + remark: string + status: number +} + +// 查询派工单分页 +export const getTaskDispatchPage = async (params) => { + return await request.get({ url: `/heli/task-dispatch/page`, params }) +} + +// 查询派工单详情 +export const getTaskDispatch = async (id: number) => { + return await request.get({ url: `/heli/task-dispatch/get?id=` + id }) +} + +// 新增派工单 +export const createTaskDispatch = async (data: TaskDispatchVO) => { + return await request.post({ url: `/heli/task-dispatch/create`, data }) +} + +// 修改派工单 +export const updateTaskDispatch = async (data: TaskDispatchVO) => { + return await request.put({ url: `/heli/task-dispatch/update`, data }) +} + +// 删除派工单 +export const deleteTaskDispatch = async (id: number) => { + return await request.delete({ url: `/heli/task-dispatch/delete?id=` + id }) +} + +// 导出派工单 Excel +export const exportTaskDispatch = async (params) => { + return await request.download({ url: `/heli/task-dispatch/export-excel`, params }) +} + +// ==================== 子表(派工明细) ==================== + +// 获得派工明细列表 +export const getTaskDispatchDetailListByDispatchId = async (dispatchId) => { + return await request.get({ url: `/heli/task-dispatch/task-dispatch-detail/list-by-dispatch-id?dispatchId=` + dispatchId }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/assets/imgs/warnicon.png b/mes-ui/mes-ui-admin-vue3/src/assets/imgs/warnicon.png new file mode 100644 index 00000000..43aad176 Binary files /dev/null and b/mes-ui/mes-ui-admin-vue3/src/assets/imgs/warnicon.png differ diff --git a/mes-ui/mes-ui-admin-vue3/src/layout/components/ToolHeader.vue b/mes-ui/mes-ui-admin-vue3/src/layout/components/ToolHeader.vue index 04f5dc61..46c0abcb 100644 --- a/mes-ui/mes-ui-admin-vue3/src/layout/components/ToolHeader.vue +++ b/mes-ui/mes-ui-admin-vue3/src/layout/components/ToolHeader.vue @@ -11,6 +11,7 @@ import RouterSearch from '@/components/RouterSearch/index.vue' import { useAppStore } from '@/store/modules/app' import { useDesign } from '@/hooks/web/useDesign' import { ThemeSwitch } from '@/layout/components/ThemeSwitch' +import Warnmessage from '@/layout/components/warnmessage.vue' const { getPrefixCls, variables } = useDesign() const prefixCls = getPrefixCls('tool-header') @@ -70,6 +71,7 @@ export default defineComponent({ ) : undefined} + ) diff --git a/mes-ui/mes-ui-admin-vue3/src/layout/components/warnmessage.vue b/mes-ui/mes-ui-admin-vue3/src/layout/components/warnmessage.vue new file mode 100644 index 00000000..607f0dd3 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/layout/components/warnmessage.vue @@ -0,0 +1,235 @@ + + + diff --git a/mes-ui/mes-ui-admin-vue3/src/store/index.ts b/mes-ui/mes-ui-admin-vue3/src/store/index.ts index 65964ea8..7740bdd3 100644 --- a/mes-ui/mes-ui-admin-vue3/src/store/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/store/index.ts @@ -1,7 +1,9 @@ import type { App } from 'vue' import { createPinia } from 'pinia' +import piniaPersist from 'pinia-plugin-persist' const store = createPinia() +store.use(piniaPersist) export const setupStore = (app: App) => { app.use(store) diff --git a/mes-ui/mes-ui-admin-vue3/src/store/modules/common.ts b/mes-ui/mes-ui-admin-vue3/src/store/modules/common.ts index db9b9658..8a35d2bc 100644 --- a/mes-ui/mes-ui-admin-vue3/src/store/modules/common.ts +++ b/mes-ui/mes-ui-admin-vue3/src/store/modules/common.ts @@ -3,19 +3,45 @@ import { store } from '../index' export interface CommonStoreState { storeMap: object + showWarning: boolean; } -export const useCommonStore = defineStore('commonStore', () => { - const storeMap = ref({}) - const getStore = (key) => { - return storeMap.value[key] +export const useCommonStore = defineStore( + 'commonStore', + { + state: (): CommonStoreState => { + return { + storeMap: {}, + showWarning: true + } + }, + actions: { + setStore(key: String, value: any) { + if(key == 'showWarning'){ + this.showWarning = value; + }else{ + this.storeMap[key] = value; + } + }, + getStore(key: string){ + if(key == 'showWarning'){ + return this.showWarning; + }else{ + return this.storeMap[key]; + } + } + }, + persist: { + enabled: true, + strategies: [ + { + key: "commonStore", + storage: localStorage + } + ] + } } - const setStore = (key, value) => { - return storeMap.value[key] = value - } - - return {getStore, setStore} -}) +) export const useCommonStateWithOut = () => { return useCommonStore(store) diff --git a/mes-ui/mes-ui-admin-vue3/src/styles/cus.scss b/mes-ui/mes-ui-admin-vue3/src/styles/cus.scss index f5dd0d61..49eacdbe 100644 --- a/mes-ui/mes-ui-admin-vue3/src/styles/cus.scss +++ b/mes-ui/mes-ui-admin-vue3/src/styles/cus.scss @@ -185,37 +185,45 @@ .iaudit { background-color: #19A998; color:#FFFFFF; + border:none; } //已启动 .istart { background-color: #1B9AEE; color: #FFFFFF; + border:none; } //已打回 .iBack { background-color: #FFEDED; color: #E62412; + border:#FFEDED; } //已变更 .ialteration { background-color:#FFF7E6; color:#D46B08; + border:none; } //已提交 .isubmit { background-color: #19A998; color:#FFFFFF; + border:none; } //已作废 .icancellation { background-color: #F0F1F4; color: #666879; + border:none; + } //已终止 .ibreakup { background-color: #F0F1F4; color: #666879; + border:none; } //全部发货 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 f401920c..86b965ce 100644 --- a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts +++ b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts @@ -240,4 +240,12 @@ export enum DICT_TYPE { HELI_DELIVER_ORDER_STATUS = 'heli_deliver_order_status', // 发货单状态 HELI_DELIVER_MODE = 'heli_deliver_mode', // 发货方式 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',//物料需求计划状态 + HELI_BOM_STATUS = 'heli_bom_status', //bom状态 + HELI_BOM_MATERIAL_TYPE = 'heli_bom_material_type', //bom物料类型 + HELI_PROJECT_PURCHASE_ORDER_TYPE = 'heli_project_purchase_order_type',//采购单类型 + HELI_PROJECT_PURCHASE_GOODS_TYPE = 'heli_project_purchase_goods_type',//采购物类型 + HELI_PURCHASE_ORDER_STATUS = 'heli_purchase_order_status',//采购单状态 } diff --git a/mes-ui/mes-ui-admin-vue3/src/views/Home/Index.vue b/mes-ui/mes-ui-admin-vue3/src/views/Home/Index.vue index 99d233b8..6e91f127 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/Home/Index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/Home/Index.vue @@ -1,22 +1,27 @@ + + + diff --git a/mes-ui/mes-ui-admin-vue3/src/views/Login/components/LoginForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/Login/components/LoginForm.vue index d530090c..cd38dcc0 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/Login/components/LoginForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/Login/components/LoginForm.vue @@ -43,7 +43,7 @@ :prefix-icon="iconLock" show-password type="password" - + @keyup.enter="getCode()" /> @@ -155,9 +155,11 @@ import * as authUtil from '@/utils/auth' import { usePermissionStore } from '@/store/modules/permission' import * as LoginApi from '@/api/login' import { LoginStateEnum, useFormValid, useLoginState } from './useLogin' +import {useCommonStore} from "@/store/modules/common"; defineOptions({ name: 'LoginForm' }) +const commonStore = useCommonStore() const { t } = useI18n() const message = useMessage() const iconHouse = useIcon({ icon: 'ep:house' }) @@ -244,6 +246,7 @@ const loading = ref() // ElLoading.service 返回的实例 // 登录 const handleLogin = async (params) => { loginLoading.value = true + commonStore.setStore('artificialWarningClose', false); try { // 固定租户 if(loginData.loginForm.username == 'admin'){ diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/classes/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/classes/index.vue index 934a1271..bc9f6d22 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/classes/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/classes/index.vue @@ -87,7 +87,7 @@ align="center" prop="createTime" :formatter="dateFormatter" - width="180px" + width="220px" />