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 af030a1f..44b32143 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 @@ -98,6 +98,7 @@ public interface ErrorCodeConstants { ErrorCode PLAN_SUB_NOT_EXISTS = new ErrorCode(1_007_002, "生产计划子项目不存在"); ErrorCode PLAN_TASK_NOT_EXISTS = new ErrorCode(1_007_003, "生产计划任务不存在"); ErrorCode PLAN_TASK_BOM_NOT_EXISTS = new ErrorCode(1_007_004, "生产计划任务Bom不存在"); + //1_007_005已被占用 /************采购管理***********/ ErrorCode MATERIAL_PLAN_NOT_EXISTS = new ErrorCode(1_008_001, "物料需求计划不存在"); ErrorCode MATERIAL_PLAN_DETAIL_NOT_EXISTS = new ErrorCode(1_008_002, "物料需求计划物料详情不存在"); 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 index 411d2e4b..97a1d278 100644 --- 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 @@ -94,7 +94,12 @@ public class PlanSubController { public CommonResult createPlanSub(@Valid @RequestBody PlanSubSaveReqVO createReqVO) { return success(planSubService.createPlanSub(createReqVO)); } - + @PostMapping("/operate") + @Operation(summary = "创建生产计划子项目") + @PreAuthorize("@ss.hasPermission('heli:plan-sub:create')") + public void operate(@RequestBody List list) { + planSubService.operate(list); + } @PutMapping("/update") @Operation(summary = "更新生产计划子项目") @PreAuthorize("@ss.hasPermission('heli:plan-sub:update')") 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 index 27e7838f..a49d9e8b 100644 --- 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 @@ -147,5 +147,7 @@ public class PlanSubRespVO { @Schema(description = "设计类型") private int type; - + private boolean hasSaveInBlankDetail; + private boolean hasSaveIn2DDetail; + private boolean hasSaveIn3DDetail; } 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 index 4b160f86..83dcb8fd 100644 --- 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 @@ -15,7 +15,7 @@ import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_Y @Data public class PlanSubSaveReqVO { - @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "自增字段,唯一") private Long id; @Schema(description = "计划id", requiredMode = Schema.RequiredMode.REQUIRED) @@ -27,7 +27,7 @@ public class PlanSubSaveReqVO { @Schema(description = "子项目id") private Long projectSubId; - + private String name; @Schema(description = "子项目简称") private String projectSubShortName; @@ -80,5 +80,7 @@ public class PlanSubSaveReqVO { @Schema(description = "3D负责人") private String threeDimOwner; - + private boolean hasSaveInBlankDetail; + private boolean hasSaveIn2DDetail; + private boolean hasSaveIn3DDetail; } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/PlanSubDetailController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/PlanSubDetailController.java index 4b2cd2ac..779cb1d8 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/PlanSubDetailController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/PlanSubDetailController.java @@ -70,6 +70,8 @@ public class PlanSubDetailController { return success(BeanUtils.toBean(planSubDetail, PlanSubDetailRespVO.class)); } + + @GetMapping("/page") @Operation(summary = "获得生产计划子项目设计时间明细分页") @PreAuthorize("@ss.hasPermission('heli:plan-sub-detail:query')") @@ -77,7 +79,13 @@ public class PlanSubDetailController { PageResult pageResult = planSubDetailService.getPlanSubDetailPage(pageReqVO); return success(BeanUtils.toBean(pageResult, PlanSubDetailRespVO.class)); } - + @GetMapping("/queryMaxDetail") + @Operation(summary = "获得生产计划子项目设计时间明细分页") + @PreAuthorize("@ss.hasPermission('heli:plan-sub-detail:query')") + public CommonResult queryMaxDetail(@Valid PlanSubDetailPageReqVO pageReqVO) { + PlanSubDetailDO pageResult = planSubDetailService.queryMaxDetail(pageReqVO); + return success(BeanUtils.toBean(pageResult, PlanSubDetailRespVO.class)); + } @GetMapping("/export-excel") @Operation(summary = "导出生产计划子项目设计时间明细 Excel") @PreAuthorize("@ss.hasPermission('heli:plan-sub-detail:export')") @@ -102,6 +110,33 @@ public class PlanSubDetailController { public CommonResult modification(@Valid @RequestBody PlanSubDetailSaveReqVO updateReqVO) { return planSubDetailService.modification(updateReqVO); } + @GetMapping("/pageAddList") + @Operation(summary = "获得生产计划子项目设计时间明细分页") + @PreAuthorize("@ss.hasPermission('heli:plan-sub-detail:query')") + public CommonResult> pageAddList(@Valid PlanSubDetailPageReqVO pageReqVO) { + PageResult pageResult = planSubDetailService.getPlanList(pageReqVO); + return success(BeanUtils.toBean(pageResult, PlanSubDetailRespVO.class)); + } + @PostMapping("/chahuo") + @Operation(summary = "插活排程") + public CommonResult chahuo(@RequestBody PlanSubDetailSaveReqVO updateReqVO) { + return planSubDetailService.chahuoList(updateReqVO); + } + @PostMapping("/savechahuo") + @Operation(summary = "保存插活结果") + public CommonResult savechahuo(@RequestBody PlanSubDetailSaveReqVO updateReqVO) { + return planSubDetailService.savechahuoList(updateReqVO); + } + + @PostMapping("/operate") + @Operation(summary = "操作页面总体数据") + public CommonResult operate(@RequestBody PlanSubDetailSaveReqVO updateReqVO) { + return planSubDetailService.operate(updateReqVO); + } + + + + @PostMapping("/insertWork") @Operation(summary = "插活") public CommonResult insertWork(@Valid @RequestBody PlanSubDetailSaveReqVO updateReqVO) { diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailPageReqVO.java index a23f7e34..49b0ad1a 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailPageReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailPageReqVO.java @@ -62,7 +62,18 @@ public class PlanSubDetailPageReqVO extends PageParam { @Schema(description = "子项目名称,唯一", example = "张三") private String name; @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED) + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime startTime; @Schema(description = "是否是最大时间段") private Integer flag; -} \ No newline at end of file + private String queryDate; + + @Schema(description = "项目编码", example = "26785") + private Long projectCode; + @Schema(description = "子项目名称" ,example = "s") + private String projectSubName; + + private String customerBrief; + private String projectName; + private String planNo; +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailRespVO.java index e3723d27..aedc2884 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailRespVO.java @@ -16,11 +16,11 @@ public class PlanSubDetailRespVO { @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "6922") @ExcelProperty("自增字段,唯一") private Long id; - + private Integer flag; @Schema(description = "计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13863") @ExcelProperty("计划id") private Long projectPlanId; - + private Long projectPlanSubId; @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11384") @ExcelProperty("项目id") private Long projectId; @@ -56,7 +56,7 @@ public class PlanSubDetailRespVO { @Schema(description = "结束( 默认0 1结束)") @ExcelProperty("结束( 默认0 1结束)") private Boolean isOverProcess; - + private Boolean userFlag = false; @Schema(description = "时间段顺序") @ExcelProperty("时间段顺序") private Long seqNo; @@ -72,5 +72,12 @@ public class PlanSubDetailRespVO { @Schema(description = "子项目名称,唯一", example = "张三") @ExcelProperty("子项目名称,唯一") private String name; + private LocalDateTime maxTime; -} \ No newline at end of file + + private String customerBrief; + private String projectName; + private String projectCode; + private String planNo; + private String projectSubName ; +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailSaveReqVO.java index 5c81544e..b4cb85d3 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/plansubdetail/vo/PlanSubDetailSaveReqVO.java @@ -13,14 +13,14 @@ import java.time.LocalDateTime; @Data public class PlanSubDetailSaveReqVO { - @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "6922") + @Schema(description = "自增字段,唯一", example = "6922") private Long id; - @Schema(description = "计划id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13863") + @Schema(description = "计划id", example = "13863") @NotNull(message = "计划id不能为空") private Long projectPlanId; - @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11384") + @Schema(description = "项目id", example = "11384") @NotNull(message = "项目id不能为空") private Long projectId; @@ -44,7 +44,7 @@ public class PlanSubDetailSaveReqVO { @Schema(description = "结束( 默认0 1结束)") private Boolean isOverProcess; - + private Long projectPlanSubId; @Schema(description = "时间段顺序") private Long seqNo; @@ -60,4 +60,5 @@ public class PlanSubDetailSaveReqVO { private String isAdd; @Schema(description = "是否新增") private List list; + } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/screen/ScreenController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/screen/ScreenController.java index 4d27e67d..7c97a44e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/screen/ScreenController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/screen/ScreenController.java @@ -8,6 +8,7 @@ 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.tenant.core.aop.TenantIgnore; import com.chanko.yunxi.mes.module.heli.controller.admin.screen.vo.ScreenPageReqVO; import com.chanko.yunxi.mes.module.heli.controller.admin.screen.vo.ScreenRespVO; import com.chanko.yunxi.mes.module.heli.controller.admin.screen.vo.ScreenSaveReqVO; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/ShopCalendarController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/ShopCalendarController.java index 92d9ca6c..6218c14a 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/ShopCalendarController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/ShopCalendarController.java @@ -52,7 +52,12 @@ public class ShopCalendarController { PageResult pageResult = shopCalendarService.searchRl(shopCalendarPageReqVO); return success(BeanUtils.toBean(pageResult, ShopCalendarRespVO.class)); } - + @GetMapping("/searchHoliday") + @Operation(summary = "查询是否节假日") + @PreAuthorize("@ss.hasPermission('heli:material:query')") + public CommonResult searchHoliday(@Valid ShopCalendarPageReqVO shopCalendarPageReqVO) { + return success(shopCalendarService.searchHoliday(shopCalendarPageReqVO)); + } @PostMapping("/insert") @Operation(summary = "新增日历") @Parameter(name = "dates", description = "年月", required = true) diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/vo/ShopCalendarPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/vo/ShopCalendarPageReqVO.java index d66909f0..570e1a75 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/vo/ShopCalendarPageReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/shopCalendar/vo/ShopCalendarPageReqVO.java @@ -31,6 +31,8 @@ public class ShopCalendarPageReqVO extends PageParam { @Schema(description = "是否节假日") private String ifjiejiari; + private String queryDate; + /* 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 index 30a5a069..166e7353 100644 --- 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 @@ -213,5 +213,10 @@ public class PlanSubDO extends BaseDO { private String businessLine; @TableField(exist = false) private int projectMonth; - + @TableField(exist = false) + private boolean hasSaveInBlankDetail; + @TableField(exist = false) + private boolean hasSaveIn3DDetail; + @TableField(exist = false) + private boolean hasSaveIn2DDetail; } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plansubdetail/PlanSubDetailDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plansubdetail/PlanSubDetailDO.java index b1555934..66cfc128 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plansubdetail/PlanSubDetailDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/plansubdetail/PlanSubDetailDO.java @@ -87,5 +87,17 @@ public class PlanSubDetailDO extends BaseDO { private String isCha; @TableField(exist = false) private Integer flag; - -} \ No newline at end of file + private Long projectPlanSubId; + @TableField(exist = false) + private LocalDateTime maxTime; + @TableField(exist = false) + private String twoDimOwnerName; + @TableField(exist = false) + private String projectSubName; + @TableField(exist = false) + private String customerBrief; + @TableField(exist = false) + private String projectName; + @TableField(exist = false) + private String planNo; +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plansubdetail/PlanSubDetailMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plansubdetail/PlanSubDetailMapper.java index 1e3bb9bc..b97744f3 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plansubdetail/PlanSubDetailMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/plansubdetail/PlanSubDetailMapper.java @@ -6,15 +6,19 @@ import cn.hutool.core.util.ObjectUtil; 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.MPJLambdaWrapperX; 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.plansubdetail.PlanSubDetailDO; 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.ProcessDesignTypeEnum; 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.plansubdetail.vo.*; +import org.apache.poi.ss.formula.functions.T; import org.springframework.util.StringUtils; /** @@ -25,6 +29,16 @@ import org.springframework.util.StringUtils; @Mapper public interface PlanSubDetailMapper extends BaseMapperX { + default PageResult getPlanList(PlanSubDetailPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(PlanSubDetailDO.class) + .leftJoin(PlanDO.class,"pl",PlanDO::getId,PlanSubDetailDO::getProjectPlanId) + .select("pl.brief as customerBrief,pl.project_name as projectName,pl.code as projectCode,pl.plan_no as planNo") + .eq(ObjectUtil.isNotEmpty(reqVO.getProjectCode()), PlanDO::getCode, reqVO.getProjectCode()) + .eq(ObjectUtil.isNotEmpty(reqVO.getProjectSubName()), PlanSubDetailDO::getName, reqVO.getProjectSubName()); + + return selectPage(reqVO, query); + } default PageResult selectPage(PlanSubDetailPageReqVO reqVO) { MPJLambdaWrapper query = new MPJLambdaWrapper<>(); @@ -34,12 +48,24 @@ public interface PlanSubDetailMapper extends BaseMapperX { .like(ObjectUtil.isNotEmpty(reqVO.getCode()), PlanSubDetailDO::getCode, reqVO.getCode()) .like(ObjectUtil.isNotEmpty(reqVO.getName()), PlanSubDetailDO::getName, reqVO.getName()) .eq(ObjectUtil.isNotEmpty(reqVO.getSubType()), PlanSubDetailDO::getSubType, reqVO.getSubType()) - .and(QueryWrapper -> QueryWrapper.gt(PlanSubDetailDO::getStartTwoDimDate, reqVO.getStartTime()) + .and(ObjectUtil.isNotEmpty(reqVO.getStartTime()),QueryWrapper -> QueryWrapper.ge(PlanSubDetailDO::getStartTwoDimDate, reqVO.getStartTime()) .or() - .lt( PlanSubDetailDO::getTwoDimDate, reqVO.getStartTime())) + .ge( PlanSubDetailDO::getTwoDimDate, reqVO.getStartTime())) .in(PlanSubDetailDO::getIsOverProcess,0,2); return selectPage(reqVO, query); } -} \ No newline at end of file + default List selectExistList(HashSet ownerList) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + query.selectAll(PlanSubDetailDO.class) + .select("psub.name as name") + .select("ad.nickname as twoDimOwnerName") + .leftJoin(PlanSubDO.class,"psub",PlanSubDO::getId,PlanSubDetailDO::getProjectPlanSubId) + .leftJoin(AdminUserDO.class,"ad",AdminUserDO::getId,PlanSubDetailDO::getTwoDimOwner) + .in(PlanSubDetailDO::getTwoDimOwner,ownerList) + .in(PlanSubDetailDO::getIsOverProcess,0,2); + return selectList(query); + } + +} 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 index f49758bc..7a38156f 100644 --- 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 @@ -23,6 +23,8 @@ public interface PlanSubService { */ Long createPlanSub(@Valid PlanSubSaveReqVO createReqVO); + + void operate(List list); /** * 更新生产计划子项目 * 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 index a281c7ba..4c18ebf5 100644 --- 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 @@ -1,7 +1,9 @@ package com.chanko.yunxi.mes.module.heli.service.plansub; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.chanko.yunxi.mes.framework.common.exception.ErrorCode; import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.chanko.yunxi.mes.module.heli.controller.admin.shopCalendar.vo.ShopCalendarPageReqVO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.plansubdetail.PlanSubDetailDO; @@ -12,6 +14,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.shopCalendar.ShopCalendar import com.chanko.yunxi.mes.module.heli.dal.mysql.plansubdetail.PlanSubDetailMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.processbom.ProcessBomMapper; 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.shopCalendar.ShopCalendarMapper; import jodd.util.StringUtil; import org.springframework.stereotype.Service; @@ -62,6 +65,218 @@ public class PlanSubServiceImpl implements PlanSubService { return planSub.getId(); } + @Override + public void operate(List list) { + HashSet userIds = new HashSet<>(); + List inserList = new ArrayList<>(); + for (PlanSubSaveReqVO planSubSaveReqVO : list) { + + if (planSubSaveReqVO.isHasSaveInBlankDetail() && planSubSaveReqVO.isHasSaveIn2DDetail() && planSubSaveReqVO.isHasSaveIn3DDetail()){ + + }else{ + inserList.add(planSubSaveReqVO); + } + if (planSubSaveReqVO.getTwoDimOwner() != null) { + userIds.add(planSubSaveReqVO.getTwoDimOwner()); + } + if (planSubSaveReqVO.getThreeDimOwner() != null) { + userIds.add(planSubSaveReqVO.getThreeDimOwner()); + } + if (planSubSaveReqVO.getBlankOwner() != null) { + userIds.add(planSubSaveReqVO.getBlankOwner()); + } + } + List planSubDetailDOS = planSubDetailMapper.selectExistList(userIds); + List insertList = new ArrayList<>(); + //检查冲突 + checkForConflicts(list,planSubDetailDOS); + List bean = BeanUtils.toBean(list, PlanSubDO.class); + planSubMapper.updateBatch(bean); + if (CollUtil.isNotEmpty(inserList)){ + for (PlanSubSaveReqVO planSubSaveReqVO : inserList) { + ProjectOrderDO projectOrderDO = projectOrderMapper.selectById(planSubSaveReqVO.getProjectId()); + List details = new ArrayList<>(); + if (planSubSaveReqVO.getBlankDate() != null && !planSubSaveReqVO.isHasSaveInBlankDetail()){ + //判断存不存在 + PlanSubDetailDO inBlankDO = new PlanSubDetailDO(); + inBlankDO.setProjectPlanId(planSubSaveReqVO.getProjectPlanId()); + inBlankDO.setProjectId(planSubSaveReqVO.getProjectId()); + inBlankDO.setProjectPlanSubId(planSubSaveReqVO.getId()); + inBlankDO.setProjectSubCode(planSubSaveReqVO.getProjectSubCode()); + inBlankDO.setTwoDimDate(planSubSaveReqVO.getBlankDate()); + inBlankDO.setProjectSubId(planSubSaveReqVO.getProjectSubId()); + inBlankDO.setStartTwoDimDate(planSubSaveReqVO.getStartBlankDate()); + inBlankDO.setTwoDimOwner(Long.valueOf(planSubSaveReqVO.getBlankOwner())); + inBlankDO.setProjectPlanId(planSubSaveReqVO.getProjectPlanId()); + inBlankDO.setSubType("BLUEPRINT_WORKBLANK"); + inBlankDO.setSeqNo(1L); + inBlankDO.setDesignNum(Long.valueOf(planSubSaveReqVO.getBlankNum())); + inBlankDO.setName(planSubSaveReqVO.getName()); + inBlankDO.setCode(projectOrderDO.getCode()); + details.add(inBlankDO); + } + if (planSubSaveReqVO.getTwoDimDate() != null && !planSubSaveReqVO.isHasSaveIn2DDetail()){ + PlanSubDetailDO in2DDO = new PlanSubDetailDO(); + in2DDO.setProjectPlanId(planSubSaveReqVO.getProjectPlanId()); + in2DDO.setProjectId(planSubSaveReqVO.getProjectId()); + in2DDO.setProjectSubId(planSubSaveReqVO.getProjectSubId()); + in2DDO.setProjectPlanSubId(planSubSaveReqVO.getId()); + in2DDO.setProjectSubCode(planSubSaveReqVO.getProjectSubCode()); + in2DDO.setTwoDimDate(planSubSaveReqVO.getTwoDimDate()); + in2DDO.setProjectPlanId(planSubSaveReqVO.getProjectPlanId()); + in2DDO.setStartTwoDimDate(planSubSaveReqVO.getStartTwoDimDate()); + in2DDO.setTwoDimOwner(Long.valueOf(planSubSaveReqVO.getBlankOwner())); + in2DDO.setSubType("BLUEPRINT_2D"); + in2DDO.setSeqNo(1L); + in2DDO.setDesignNum(Long.valueOf(planSubSaveReqVO.getBlankNum())); + in2DDO.setName(planSubSaveReqVO.getName()); + in2DDO.setCode(projectOrderDO.getCode()); + details.add(in2DDO); + } + + if (planSubSaveReqVO.getThreeDimDate() != null && !planSubSaveReqVO.isHasSaveIn3DDetail()){ + PlanSubDetailDO in3DDO = new PlanSubDetailDO(); + in3DDO.setProjectPlanId(planSubSaveReqVO.getProjectPlanId()); + in3DDO.setProjectId(planSubSaveReqVO.getProjectId()); + in3DDO.setProjectPlanSubId(planSubSaveReqVO.getId()); + in3DDO.setProjectPlanId(planSubSaveReqVO.getProjectPlanId()); + in3DDO.setProjectSubId(planSubSaveReqVO.getProjectSubId()); + in3DDO.setProjectSubCode(planSubSaveReqVO.getProjectSubCode()); + in3DDO.setTwoDimDate(planSubSaveReqVO.getThreeDimDate()); + in3DDO.setStartTwoDimDate(planSubSaveReqVO.getStartThreeDimDate()); + in3DDO.setTwoDimOwner(Long.valueOf(planSubSaveReqVO.getBlankOwner())); + in3DDO.setSubType("BLUEPRINT_3D"); + in3DDO.setSeqNo(1L); + in3DDO.setDesignNum(Long.valueOf(planSubSaveReqVO.getBlankNum())); + in3DDO.setName(planSubSaveReqVO.getName()); + in3DDO.setCode(projectOrderDO.getCode()); + details.add(in3DDO); + } + //把这个底下的都查出来 + planSubDetailMapper.insertOrUpdateBatch(details); + } + } + } + + + /** + * 检查任务冲突 + * @param processTasks list1, 新的工艺任务列表 + * @param existingTasks list2, 已存在的任务列表 + * @throws RuntimeException 如果发现任何时间冲突 + */ + public void checkForConflicts(List processTasks, List existingTasks) { + // 为了提高查询效率,将 list2 按 Owner 转换为 Map + Map> tasksByOwner = new HashMap<>(); + for (PlanSubDetailDO task : existingTasks) { + tasksByOwner.computeIfAbsent(task.getTwoDimOwner(), k -> new ArrayList<>()).add(task); + } + + // 1. 检查 list1 内部的时间冲突 + checkInternalConflicts(processTasks); + + // 2. 检查 list1 与 list2 之间的时间冲突 + checkExternalConflicts(processTasks, tasksByOwner); + } + + /** + * 检查 list1 内部,同一责任人负责的工艺时间是否有交集 + */ + private void checkInternalConflicts(List processTasks) { + // 将每个工艺任务拆分成独立的任务项,方便统一检查 + List allNewItems = new ArrayList<>(); + for (PlanSubSaveReqVO task : processTasks) { + if (!task.isHasSaveInBlankDetail() && task.getBlankOwner() != null && task.getStartBlankDate() != null && task.getBlankDate() != null) { + allNewItems.add(new TaskItem(Long.valueOf(task.getBlankOwner()), task.getStartBlankDate(), task.getBlankDate(), "毛坯",task.getProjectNameSim())); + } + if (!task.isHasSaveIn2DDetail() && task.getTwoDimOwner() != null && task.getStartTwoDimDate() != null && task.getTwoDimDate() != null) { + allNewItems.add(new TaskItem(Long.valueOf(task.getTwoDimOwner()), task.getStartTwoDimDate(), task.getTwoDimDate(), "2D",task.getProjectSubShortName())); + } + if (!task.isHasSaveIn3DDetail() && task.getThreeDimOwner() != null && task.getStartThreeDimDate() != null && task.getThreeDimDate() != null) { + allNewItems.add(new TaskItem(Long.valueOf(task.getThreeDimOwner()), task.getStartThreeDimDate(), task.getThreeDimDate(), "3D",task.getProjectSubShortName())); + } + } + + // 对所有新任务项进行两两比较 + for (int i = 0; i < allNewItems.size(); i++) { + TaskItem item1 = allNewItems.get(i); + for (int j = i + 1; j < allNewItems.size(); j++) { + TaskItem item2 = allNewItems.get(j); + // 只检查同一个责任人负责的任务 + if (item1.owner.equals(item2.owner)) { + if (hasOverlap(item1.start, item1.end, item2.start, item2.end)) { + throw exception(new ErrorCode(1_007_006,"当前插入:"+item1.type+item1.start.toString().substring(0,10)+" -"+item1.end.toString().substring(0,10)+"跟"+item2.type+item2.start.toString().substring(0,10)+item2.end.toString().substring(0,10)+"存在交集,请确认!")); + } + } + } + } + } + + /** + * 检查 list1 的新任务是否与 list2 中已存在的任务冲突 + */ + private void checkExternalConflicts(List processTasks, Map> tasksByOwner) { + for (PlanSubSaveReqVO newTask : processTasks) { + // 检查毛坯任务 + if (!newTask.isHasSaveInBlankDetail() && newTask.getBlankOwner() != null){ + checkTaskAgainstExisting(Long.valueOf(newTask.getBlankOwner()), newTask.getStartBlankDate(), newTask.getBlankDate(), "BLUEPRINT_WORKBLANK", tasksByOwner); + } + // 检查2D任务 + if (!newTask.isHasSaveIn2DDetail() && newTask.getTwoDimOwner() != null){ + checkTaskAgainstExisting(Long.valueOf(newTask.getTwoDimOwner()), newTask.getStartTwoDimDate(), newTask.getTwoDimDate(), "BLUEPRINT_2D", tasksByOwner); + + } + // 检查3D任务 + if (!newTask.isHasSaveIn3DDetail() && newTask.getThreeDimOwner() != null){ + checkTaskAgainstExisting(Long.valueOf(newTask.getThreeDimOwner()), newTask.getStartThreeDimDate(), newTask.getThreeDimDate(), "BLUEPRINT_3D", tasksByOwner); + + } + } + } + + /** + * 辅助方法:检查单个新任务与已存在任务的冲突 + */ + private void checkTaskAgainstExisting(Long owner, LocalDateTime start, LocalDateTime end, String taskType, Map> tasksByOwner) { + if (owner == null || start == null || end == null) { + return; // 如果责任人或时间为空,则无需检查 + } + + List existingTasksForOwner = tasksByOwner.get(owner); + if (existingTasksForOwner == null) { + return; // 如果该责任人没有已存在的任务,则无需检查 + } + String typeName = ""; + if (taskType.equals("BLUEPRINT_3D")){ + typeName = "3D"; + }else if (taskType.equals("BLUEPRINT_2D")){ + typeName = "2D"; + }else if (taskType.equals("BLUEPRINT_WORKBLANK")){ + typeName = "毛坯"; + } + for (PlanSubDetailDO existingTask : existingTasksForOwner) { + if (hasOverlap(start, end, existingTask.getStartTwoDimDate(), existingTask.getTwoDimDate())) { + throw exception(new ErrorCode(1_007_006,"当前插入"+start.toString().substring(0,10)+" -"+end.toString().substring(0,10)+"跟"+existingTask.getName()+"-"+typeName+existingTask.getStartTwoDimDate().toString().substring(0,10)+existingTask.getTwoDimDate().toString().substring(0,10)+"存在交集,请确认!")); + } + } + } + + // 内部辅助类,用于简化任务处理 + private static class TaskItem { + final String projectName; + final Long owner; + final LocalDateTime start; + final LocalDateTime end; + final String type; // "毛坯", "2D", "3D" + + TaskItem(Long owner, LocalDateTime start, LocalDateTime end, String type,String projectName) { + this.owner = owner; + this.start = start; + this.end = end; + this.type = type; + this.projectName = projectName; + } + } @Override public void updatePlanSub(PlanSubSaveReqVO updateReqVO) { // 校验存在 @@ -239,9 +454,6 @@ public class PlanSubServiceImpl implements PlanSubService { } //将所有信息查完之后,根据createTime进行排序 planSubDOSs.sort(Comparator.comparing(PlanSubDO::getCreateTime)); - // 输出排序后的结果 - System.out.println("输出排序后结果"); - planSubDOSs.forEach(System.out::println); //用来获取日历时间段 String endTimes = null;//tableData.get(tableData.size()-1).getBlankDate().format(formatter); @@ -355,7 +567,14 @@ public class PlanSubServiceImpl implements PlanSubService { LocalDateTime dateTime = LocalDateTime.parse(str, formatter); return dateTime; } - + public static boolean hasOverlap(LocalDateTime start1, LocalDateTime end1, LocalDateTime start2, LocalDateTime end2) { + // 处理 null 值,如果任一时间为 null,则认为该时间范围无效,不产生交集 + if (start1 == null || end1 == null || start2 == null || end2 == null) { + return false; + } + // 核心判断逻辑 + return start1.compareTo(end2) <= 0 && start2.compareTo(end1) <= 0; + } /* * 转换日期方法 * */ @@ -392,7 +611,27 @@ public class PlanSubServiceImpl implements PlanSubService { @Override public PageResult getPlanSubPage(PlanSubPageReqVO pageReqVO) { - return planSubMapper.selectPage(pageReqVO); + PageResult planSubDOPageResult = planSubMapper.selectPage(pageReqVO); + List list = planSubDOPageResult.getList(); + for (PlanSubDO planSubDO : list) { + List planSubDetailDOS1 = planSubDetailMapper.selectList(new LambdaQueryWrapperX().eq(PlanSubDetailDO::getProjectPlanSubId, planSubDO.getId()) + .eq(PlanSubDetailDO::getSubType,"BLUEPRINT_WORKBLANK")); + List planSubDetailDOS2 = planSubDetailMapper.selectList(new LambdaQueryWrapperX().eq(PlanSubDetailDO::getProjectPlanSubId, planSubDO.getId()) + .eq(PlanSubDetailDO::getSubType,"BLUEPRINT_2D")); + List planSubDetailDOS3 = planSubDetailMapper.selectList(new LambdaQueryWrapperX().eq(PlanSubDetailDO::getProjectPlanSubId, planSubDO.getId()) + .eq(PlanSubDetailDO::getSubType,"BLUEPRINT_3D")); + + if (CollUtil.isNotEmpty(planSubDetailDOS1)) { + planSubDO.setHasSaveInBlankDetail(true); + } + if (CollUtil.isNotEmpty(planSubDetailDOS2)) { + planSubDO.setHasSaveIn2DDetail(true); + } + if (CollUtil.isNotEmpty(planSubDetailDOS3)) { + planSubDO.setHasSaveIn3DDetail(true); + } + } + return planSubDOPageResult; } } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailService.java index 4a47d292..42b6713e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailService.java @@ -54,9 +54,14 @@ public interface PlanSubDetailService { */ PageResult getPlanSubDetailPage(PlanSubDetailPageReqVO pageReqVO); + PageResult getPlanList(PlanSubDetailPageReqVO pageReqVO); + + PlanSubDetailDO queryMaxDetail(PlanSubDetailPageReqVO pageReqVO); + Integer getSearchRlTs(String startDateTime); - + CommonResult chahuoList(PlanSubDetailSaveReqVO updateReqVO); + CommonResult savechahuoList(PlanSubDetailSaveReqVO updateReqVO); CommonResult modification(PlanSubDetailSaveReqVO updateReqVO); - + CommonResult operate(PlanSubDetailSaveReqVO updateReqVO); CommonResult insertWork(PlanSubDetailSaveReqVO updateReqVO); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailServiceImpl.java index fe1773b7..679a8b77 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plansubdetail/PlanSubDetailServiceImpl.java @@ -1,21 +1,29 @@ package com.chanko.yunxi.mes.module.heli.service.plansubdetail; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +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.purchaseordernodetail.PurchaseOrderNoDetailDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.shopCalendar.ShopCalendarDO; import com.chanko.yunxi.mes.module.heli.dal.mysql.plansub.PlanSubMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.processdesign.ProcessDesignMapper; import com.chanko.yunxi.mes.module.heli.dal.mysql.shopCalendar.ShopCalendarMapper; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.time.Instant; import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -45,6 +53,8 @@ public class PlanSubDetailServiceImpl implements PlanSubDetailService { private ShopCalendarMapper shopCalendarMapper; @Resource private PlanSubMapper planSubMapper; + @Resource + private ProcessDesignMapper processDesignMapper; @Override public Long createPlanSubDetail(PlanSubDetailSaveReqVO createReqVO) { @@ -71,11 +81,10 @@ public class PlanSubDetailServiceImpl implements PlanSubDetailService { PlanSubDetailDO planSubDetailDO = planSubDetailMapper.selectById(id); // 获取当前日期时间 LocalDateTime now = LocalDateTime.now(); - // 判断 当前时间是否在startTwoDimDate之后 boolean isGreaterThanCurrent = now.isAfter(planSubDetailDO.getStartTwoDimDate()); if (isGreaterThanCurrent) return CommonResult.error(400,"当前日期>开始日期,不允许删除"); - if (ObjectUtil.isNotEmpty(planSubDetailDO.getIsOverProcess())&& planSubDetailDO.getIsOverProcess()==1&&planSubDetailDO.getSeqNo()==1){ + if (ObjectUtil.isNotEmpty(planSubDetailDO.getIsOverProcess()) && planSubDetailDO.getIsOverProcess() == 2 && planSubDetailDO.getSeqNo()==1){ return CommonResult.error(400,"该设计已报工,不允许删除"); } LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); @@ -166,6 +175,73 @@ public class PlanSubDetailServiceImpl implements PlanSubDetailService { return planSubDetailDOPageResult; } + @Override + public PageResult getPlanList(PlanSubDetailPageReqVO pageReqVO) { + + return planSubDetailMapper.getPlanList(pageReqVO); + } + + @Override + public PlanSubDetailDO queryMaxDetail(PlanSubDetailPageReqVO pageReqVO) { + //判断一下 + //twoDimOwner是设计责任人 + PlanSubDetailDO planSubDetailDO = planSubDetailMapper.selectOne(new LambdaQueryWrapper() + .eq(PlanSubDetailDO::getTwoDimOwner, pageReqVO.getTwoDimOwner()) + .in(PlanSubDetailDO::getIsOverProcess,Arrays.asList(0,2)) + .ne(PlanSubDetailDO::getProjectId,pageReqVO.getProjectId()) + .orderByDesc(PlanSubDetailDO::getTwoDimDate).last("limit 1")); + if (planSubDetailDO != null){ + if (pageReqVO.getQueryDate() != null){ + //如果日期不为空,查询最大日期 + Long l = Long.valueOf(pageReqVO.getQueryDate()); + Instant instant = Instant.ofEpochMilli(l); + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + LocalDateTime startDate = localDateTime.with(LocalTime.MIN); + LocalDateTime now = LocalDateTime.now(); + now = now.with(LocalTime.MIN); + //比较一下日期哪个大 + if (planSubDetailDO.getTwoDimDate().compareTo(startDate) > 0){ + startDate = planSubDetailDO.getTwoDimDate(); + } + if (now.compareTo(startDate)>0){ + startDate = now; + } + ShopCalendarDO maxShopCalendar = shopCalendarMapper.selectOne(new LambdaQueryWrapper().ge(ShopCalendarDO::getDates, startDate) + .eq(ShopCalendarDO::getIfjiejiari, "false").orderByAsc(ShopCalendarDO::getDates).last("limit 1")); + if (maxShopCalendar != null){ + planSubDetailDO.setMaxTime(maxShopCalendar.getDates()); + }else{ + planSubDetailDO.setMaxTime(startDate.plusDays(1)); + } + }else{ + planSubDetailDO.setMaxTime(planSubDetailDO.getTwoDimDate().plusDays(1)); + } + }else{ + if (pageReqVO.getQueryDate() != null){ + PlanSubDetailDO planSubDetailDO1 = new PlanSubDetailDO(); + //如果日期不为空,查询最大日期 + Long l = Long.valueOf(pageReqVO.getQueryDate()); + Instant instant = Instant.ofEpochMilli(l); + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + LocalDateTime startDate = localDateTime.with(LocalTime.MIN); + LocalDateTime now = LocalDateTime.now(); + now = now.with(LocalTime.MIN); + if (now.compareTo(startDate)>0){ + startDate = now; + } + ShopCalendarDO maxShopCalendar = shopCalendarMapper.selectOne(new LambdaQueryWrapper().ge(ShopCalendarDO::getDates, startDate) + .eq(ShopCalendarDO::getIfjiejiari, "false").orderByAsc(ShopCalendarDO::getDates).last("limit 1")); + if (maxShopCalendar != null){ + planSubDetailDO1.setMaxTime(maxShopCalendar.getDates()); + }else{ + planSubDetailDO1.setMaxTime(startDate.plusDays(1)); + } + planSubDetailDO = planSubDetailDO1; + } + } + return planSubDetailDO; + } + @Override public Integer getSearchRlTs(String startDateTime) { List shopCalendarDOS =shopCalendarMapper.getSearchRlT(startDateTime); @@ -194,7 +270,7 @@ public class PlanSubDetailServiceImpl implements PlanSubDetailService { LocalDateTime existStart = planSubDetailDO.getStartTwoDimDate(); LocalDateTime existEnd = planSubDetailDO.getTwoDimDate(); // 判断请求时间段是否与已有时间段有重叠 - boolean hasOverlap = !reqEnd.isBefore(existStart) && !reqStart.isAfter(existEnd); + boolean hasOverlap = !(reqEnd.compareTo(existStart) < 0) && !(reqStart.compareTo(existEnd) > 0); if (hasOverlap) { return CommonResult.error(400, "该子项目设计时间存在交叉,请确认!"); } @@ -205,18 +281,27 @@ public class PlanSubDetailServiceImpl implements PlanSubDetailService { wrapper1.eq(PlanSubDetailDO::getProjectSubId,updateReqVO.getProjectSubId()); wrapper1.eq(PlanSubDetailDO::getSubType,updateReqVO.getSubType()); String type="BLUEPRINT_WORKBLANK".equals(updateReqVO.getSubType())?"毛坯":"BLUEPRINT_2D".equals(updateReqVO.getSubType())?"2D":"3D"; - if (planSubDetailMapper.selectCount(wrapper1)>0) return CommonResult.error(400,"该子项目"+updateReqVO.getName()+" 设计类型"+type+" 存在派工数据,请确认!"); + if (planSubDetailMapper.selectCount(wrapper1)> 0 ) return CommonResult.error(400,"该子项目"+updateReqVO.getName()+" 设计类型"+type+" 存在派工数据,请确认!"); } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.in(PlanSubDetailDO::getIsOverProcess,0,2); lambdaQueryWrapper.eq(PlanSubDetailDO::getTwoDimOwner,updateReqVO.getTwoDimOwner()); - lambdaQueryWrapper.ge(PlanSubDetailDO::getStartTwoDimDate,updateReqVO.getStartTwoDimDate()); + lambdaQueryWrapper.ge(PlanSubDetailDO::getTwoDimDate,updateReqVO.getStartTwoDimDate()); lambdaQueryWrapper.orderByAsc(PlanSubDetailDO::getStartTwoDimDate); - if (ObjectUtil.isNotEmpty(updateReqVO.getId())){ - lambdaQueryWrapper.ne(PlanSubDetailDO::getId,updateReqVO.getId()); - } +// if (ObjectUtil.isNotEmpty(updateReqVO.getId())){ +// lambdaQueryWrapper.ne(PlanSubDetailDO::getId,updateReqVO.getId()); +// } List list = planSubDetailMapper.selectList(lambdaQueryWrapper); - if (ObjectUtil.isEmpty( list) ||updateReqVO.getTwoDimDate().isBefore(list.get(0).getStartTwoDimDate())){ + List noSelfList = new ArrayList<>(); + for (PlanSubDetailDO planSubDetailDO : list) { + if (!planSubDetailDO.getId().equals(updateReqVO.getId())){ + noSelfList.add(planSubDetailDO); + } + } + + if (ObjectUtil.isEmpty( noSelfList) && ((updateReqVO.getStartTwoDimDate().compareTo(noSelfList.get(0).getTwoDimDate()) <=0 )&& (updateReqVO.getTwoDimDate().compareTo(noSelfList.get(0).getStartTwoDimDate()) >= 0))){ if (ObjectUtil.isNotEmpty(updateReqVO.getId())){ planSubDetailMapper.delete(PlanSubDetailDO::getId,updateReqVO.getId()); } @@ -233,12 +318,495 @@ public class PlanSubDetailServiceImpl implements PlanSubDetailService { planSubDetailDO.setSeqNo(1L); planSubDetailDO.setDesignNum(updateReqVO.getDesignNum()); planSubDetailDO.setCode(updateReqVO.getCode()); + list.add(planSubDetailDO); + list.sort(Comparator.comparing(PlanSubDetailDO::getStartTwoDimDate, Comparator.nullsLast(Comparator.naturalOrder()))); + for (int i = 0; i < list.size(); i++) { + list.get(i).setSeqNo(Long.valueOf(i + 1)); // 设置顺序为 1, 2, 3 + } + planSubDetailMapper.insertOrUpdateBatch(list); return CommonResult.success(true); } updateReqVO.setList( list); return CommonResult.success(updateReqVO); } + @Override + public CommonResult operate(PlanSubDetailSaveReqVO updateReqVO) { + List list = updateReqVO.getList(); + HashSet ownerSet = new HashSet<>(); + for (PlanSubDetailDO planSubDetailDO : list) { + if (planSubDetailDO.getId() == null){ + String type="BLUEPRINT_WORKBLANK".equals(planSubDetailDO.getSubType())?"毛坯":"BLUEPRINT_2D".equals(planSubDetailDO.getSubType())?"2D":"3D"; + //该项目名称+子项目名称+类型没有保存,请先修改! + return CommonResult.error(400, "该子项目"+planSubDetailDO.getName()+" 设计类型"+type+" ,没有保存请确认!"); + }else { + + planSubDetailDO.setDesignNum(calculateWorkDays(planSubDetailDO.getStartTwoDimDate(),planSubDetailDO.getTwoDimDate())); + ownerSet.add(planSubDetailDO.getTwoDimOwner()); + } + } + + if (ownerSet.size() > 1){ + return CommonResult.error(400, "项目存在多个负责人,不允许保存。请单条修改!"); + } + for (PlanSubDetailDO planSubDetailDO : list) { + for (PlanSubDetailDO subDetailDO : list) { + if(!planSubDetailDO.getId().equals(subDetailDO.getId())){ + //判断时间交叉 + LocalDateTime reqStart = subDetailDO.getStartTwoDimDate(); + LocalDateTime reqEnd = subDetailDO.getTwoDimDate(); + LocalDateTime existStart = planSubDetailDO.getStartTwoDimDate(); + LocalDateTime existEnd = planSubDetailDO.getTwoDimDate(); + // 判断请求时间段是否与已有时间段有重叠 + boolean hasOverlap = !(reqEnd.compareTo(existStart) < 0) && !(reqStart.compareTo(existEnd) > 0); + if (hasOverlap) { + return CommonResult.error(400, "该子项目设计时间存在交叉,请确认!"); + } + } + + } + } + planSubDetailMapper.updateBatch(list); + //更新表pro_process_design + Map> collect = list.stream().collect(Collectors.groupingBy(PlanSubDetailDO::getProjectPlanSubId)); + + return CommonResult.success(true); + + } + + @Override + @Transactional + public CommonResult savechahuoList(PlanSubDetailSaveReqVO updateReqVO){ + List list = updateReqVO.getList(); + list.sort(Comparator.comparing(PlanSubDetailDO::getStartTwoDimDate, Comparator.nullsLast(Comparator.naturalOrder()))); + Map> collect = list.stream().filter(item -> item.getId() != null ).collect(Collectors.groupingBy(PlanSubDetailDO::getId)); + HashSet deleteId = new HashSet<>(); + for (Long id : collect.keySet()) { + List planSubDetailDOS = collect.get(id); + if (collect.get(id).size() > 1){ + deleteId.add(id); + for (PlanSubDetailDO planSubDetailDO : collect.get(id)) { + planSubDetailDO.setId(null); + } + } + } + Map> collect1 = list.stream().collect(Collectors.groupingBy(PlanSubDetailDO::getProjectSubId)); + collect1.forEach((id,detailList) -> { + Map> collect2 = detailList.stream().collect(Collectors.groupingBy(PlanSubDetailDO::getSubType)); + collect2.forEach((type,list2) ->{ + int i = 1; + for (PlanSubDetailDO planSubDetailDO : list2) { + planSubDetailDO.setSeqNo(Long.valueOf(i++)); + } + }); + }); + + planSubDetailMapper.deleteBatchIds(deleteId); + planSubDetailMapper.insertOrUpdateBatch(list); + return CommonResult.success(true); + } + + @Override + @Transactional + public CommonResult chahuoList(PlanSubDetailSaveReqVO updateReqVO) { + List list = updateReqVO.getList(); + if (CollUtil.isEmpty(list)) { + return CommonResult.error(400, "列表为空,请刷新页面后重试!"); + } + + // 1. 拿到整个list最大的twoDimDate时间 + LocalDateTime minDate = list.stream() + .map(PlanSubDetailDO::getStartTwoDimDate) + .min(LocalDateTime::compareTo) + .orElse(null); + LocalDateTime maxDate = list.stream() + .map(PlanSubDetailDO::getTwoDimDate) + .max(LocalDateTime::compareTo) + .orElse(null); + + // 2. 查询最大时间往后90天内的节假日 + LocalDateTime endDate = maxDate.plusDays(90); + List shopCalendarDOList = shopCalendarMapper.selectList(new LambdaQueryWrapper().eq(ShopCalendarDO::getIfjiejiari, "true") + .between(ShopCalendarDO::getDates, minDate, endDate).orderByAsc(ShopCalendarDO::getDates)); + List holidayList = new ArrayList<>(); + for (ShopCalendarDO shopCalendarDO : shopCalendarDOList) { + holidayList.add(shopCalendarDO.getDates()); + } + + // 3. 将id为空的数据拿出来进行插活 + List insertList = list.stream() + .filter(item -> item.getId() == null) + .collect(Collectors.toList()); + for (PlanSubDetailDO planSubDetailDO : insertList) { + planSubDetailDO.setIsCha("Y"); + } + // 4. 将id不为空的按startTwoDimDate进行升序排序,形成baseList + List baseList = list.stream() + .filter(item -> item.getId() != null) + .sorted(Comparator.comparing(PlanSubDetailDO::getStartTwoDimDate)) + .collect(Collectors.toList()); + + // 5. 执行插活逻辑 + List resultList = performInsertLogic(baseList, insertList, holidayList); + + // 6. 保存结果 + updateReqVO.setList(resultList); + return CommonResult.success(updateReqVO); + } + + /** + * 执行插活逻辑 + */ + private List performInsertLogic(List baseList, + List insertList, + List holidayList) { + List resultList = new ArrayList<>(); + + // 1. 先处理插活数据,按节假日分段 + List processedInsertList = new ArrayList<>(); + for (PlanSubDetailDO insertItem : insertList) { + LocalDateTime startDate = insertItem.getStartTwoDimDate(); + LocalDateTime endDate = insertItem.getTwoDimDate(); + + // 检查该时间段内是否有节假日 + List holidaysInRange = getHolidaysInRange(startDate, endDate, holidayList); + + if (holidaysInRange.isEmpty()) { + // 没有节假日,直接添加 + processedInsertList.add(insertItem); + } else { + // 有节假日,需要分段处理 + List segments = splitByHolidays(insertItem, holidaysInRange); + processedInsertList.addAll(segments); + } + } + + // 2. 如果没有插活数据,直接返回baseList + if (processedInsertList.isEmpty()) { + return new ArrayList<>(baseList); + } + + // 3. 获取插活数据的开始时间 + LocalDateTime insertStartTime = processedInsertList.stream() + .map(PlanSubDetailDO::getStartTwoDimDate) + .min(LocalDateTime::compareTo) + .orElse(null); + + // 4. 分离baseList:在插活数据之前的、被打断的、在插活数据之后的 + List beforeInsertList = new ArrayList<>(); + List interruptedList = new ArrayList<>(); + List afterInsertList = new ArrayList<>(); + List remainingBaseList = new ArrayList<>(); + + if (insertStartTime != null) { + for (PlanSubDetailDO baseItem : baseList) { + if (baseItem.getTwoDimDate().isBefore(insertStartTime)) { + // 完全在插活数据之前 + beforeInsertList.add(baseItem); + } else if (baseItem.getStartTwoDimDate().isBefore(insertStartTime) && + baseItem.getTwoDimDate().isAfter(insertStartTime.minusDays(1))) { + // 被插活数据打断 + interruptedList.add(baseItem); + } else { + // 在插活数据之后 + afterInsertList.add(baseItem); + } + } + } else { + beforeInsertList.addAll(baseList); + } + + // 5. 处理插活数据之前的baseList(保持原样) + resultList.addAll(beforeInsertList); + + // 6. 处理被打断的baseList + for (PlanSubDetailDO interruptedItem : interruptedList) { + // 计算插活数据开始前的天数 + long daysBeforeInsert = ChronoUnit.DAYS.between(interruptedItem.getStartTwoDimDate(), insertStartTime); + + if (daysBeforeInsert > 0) { + // 创建插活前的段落 + LocalDateTime segmentEnd = interruptedItem.getStartTwoDimDate().plusDays(daysBeforeInsert - 1); + PlanSubDetailDO beforeSegment = createBaseItem(interruptedItem, interruptedItem.getStartTwoDimDate(), segmentEnd); + beforeSegment.setDesignNum(daysBeforeInsert); + resultList.add(beforeSegment); + + // 保存剩余的designNum + Long remainingDesignNum = interruptedItem.getDesignNum() - daysBeforeInsert; + if (remainingDesignNum > 0) { + // 创建剩余的baseItem,稍后处理 + PlanSubDetailDO remainingItem = new PlanSubDetailDO(); + // 复制属性 + remainingItem.setId(interruptedItem.getId()); + remainingItem.setProjectPlanId(interruptedItem.getProjectPlanId()); + remainingItem.setProjectId(interruptedItem.getProjectId()); + remainingItem.setProjectPlanSubId(interruptedItem.getProjectPlanSubId()); + remainingItem.setProjectSubCode(interruptedItem.getProjectSubCode()); + remainingItem.setTwoDimOwner(interruptedItem.getTwoDimOwner()); + remainingItem.setProjectSubId(interruptedItem.getProjectSubId()); + remainingItem.setSubType(interruptedItem.getSubType()); + remainingItem.setName(interruptedItem.getName()); + remainingItem.setCode(interruptedItem.getCode()); + remainingItem.setDesignNum(remainingDesignNum); + remainingBaseList.add(remainingItem); + } + } else { + // 整个被打断,全部加入剩余列表 + remainingBaseList.add(interruptedItem); + } + } + + // 7. 添加插活数据 + resultList.addAll(processedInsertList); + + // 8. 处理剩余的baseList(被打断的剩余部分 + 原本在插活数据之后的) + List allRemainingList = new ArrayList<>(); + allRemainingList.addAll(remainingBaseList); + allRemainingList.addAll(afterInsertList); + + if (!allRemainingList.isEmpty()) { + // 获取插活数据的最后结束时间 + LocalDateTime lastInsertEndTime = processedInsertList.stream() + .map(PlanSubDetailDO::getTwoDimDate) + .max(LocalDateTime::compareTo) + .orElse(null); + + // 从插活数据的下一天开始顺延 + LocalDateTime baseStartTime = lastInsertEndTime.plusDays(1); + + for (PlanSubDetailDO baseItem : allRemainingList) { + // 按照原有的designNum计算新的时间段 + LocalDateTime newStartTime = baseStartTime; + LocalDateTime newEndTime = newStartTime.plusDays(baseItem.getDesignNum() - 1); + + // 检查新的时间段内是否有节假日 + List holidaysInRange = getHolidaysInRange(newStartTime, newEndTime, holidayList); + + if (holidaysInRange.isEmpty()) { + // 没有节假日,直接添加 + PlanSubDetailDO newBaseItem = createBaseItem(baseItem, newStartTime, newEndTime); + resultList.add(newBaseItem); + baseStartTime = newEndTime.plusDays(1); + } else { + // 有节假日,需要分段处理 + List segments = splitBaseItemByHolidays(baseItem, newStartTime, newEndTime, holidaysInRange); + resultList.addAll(segments); + + // 更新下一个baseItem的开始时间 + LocalDateTime lastSegmentEndTime = segments.stream() + .map(PlanSubDetailDO::getTwoDimDate) + .max(LocalDateTime::compareTo) + .orElse(newEndTime); + baseStartTime = lastSegmentEndTime.plusDays(1); + } + } + } + + // 9. 按开始时间排序 + resultList.sort(Comparator.comparing(PlanSubDetailDO::getStartTwoDimDate)); + + return resultList; + } + + private List splitByHolidays(PlanSubDetailDO original, List holidaysInRange) { + List segments = new ArrayList<>(); + LocalDateTime currentStart = original.getStartTwoDimDate(); + LocalDateTime originalEnd = original.getTwoDimDate(); + + for (LocalDateTime holiday : holidaysInRange) { + // 修复:只有当currentStart在节假日前时才创建节假日前的一段 + if (currentStart.isBefore(holiday)) { + LocalDateTime segmentEnd = holiday.minusDays(1); + if (currentStart.isBefore(segmentEnd) || currentStart.isEqual(segmentEnd)) { + // 节假日前的段落 + PlanSubDetailDO beforeHoliday = createSegment(original, currentStart, segmentEnd); + segments.add(beforeHoliday); + } + } + // 跳过节假日,从节假日后一天开始 + currentStart = holiday.plusDays(1); + } + + // 最后一段:确保还有剩余时间 + if (!currentStart.isAfter(originalEnd)) { + PlanSubDetailDO lastSegment = createSegment(original, currentStart, originalEnd); + segments.add(lastSegment); + } + + return segments; + } + + /** + * 按节假日分段(带时间控制,用于插活数据) + */ + private List splitByHolidaysWithTime(PlanSubDetailDO original, + LocalDateTime startTime, + LocalDateTime endTime, + List holidaysInRange) { + List segments = new ArrayList<>(); + LocalDateTime currentStart = startTime; + + for (LocalDateTime holiday : holidaysInRange) { + if (currentStart.isBefore(holiday)) { + LocalDateTime segmentEnd = holiday.minusDays(1); + if (currentStart.isBefore(segmentEnd) || currentStart.isEqual(segmentEnd)) { + PlanSubDetailDO beforeHoliday = createSegment(original, currentStart, segmentEnd); + segments.add(beforeHoliday); + } + } + currentStart = holiday.plusDays(1); + } + + // 最后一段 + if (!currentStart.isAfter(endTime)) { + PlanSubDetailDO lastSegment = createSegment(original, currentStart, endTime); + segments.add(lastSegment); + } + + return segments; + } + + + + private List splitBaseItemByHolidays(PlanSubDetailDO original, + LocalDateTime startTime, + LocalDateTime endTime, + List holidaysInRange) { + List segments = new ArrayList<>(); + LocalDateTime currentStart = startTime; + Long totalDesignNum = original.getDesignNum(); + Long usedDesignNum = 0L; + + for (LocalDateTime holiday : holidaysInRange) { + if (currentStart.isBefore(holiday)) { + // 计算到节假日前一天的天数 + long daysToHoliday = ChronoUnit.DAYS.between(currentStart, holiday); + + if (daysToHoliday > 0) { + long segmentDays = Math.min(daysToHoliday, totalDesignNum - usedDesignNum); + + if (segmentDays > 0) { + // 节假日前的段落 + LocalDateTime segmentEnd = currentStart.plusDays(segmentDays - 1); + PlanSubDetailDO beforeHoliday = createBaseItem(original, currentStart, segmentEnd); + beforeHoliday.setDesignNum(segmentDays); // 设置实际的designNum + segments.add(beforeHoliday); + usedDesignNum += segmentDays; + currentStart = holiday.plusDays(1); + } + } else { + currentStart = holiday.plusDays(1); + } + + // 如果已经用完了designNum,直接返回 + if (usedDesignNum >= totalDesignNum) { + return segments; + } + } else { + currentStart = holiday.plusDays(1); + } + } + + // 最后一段 + if (usedDesignNum < totalDesignNum) { + long remainingDays = totalDesignNum - usedDesignNum; + LocalDateTime lastSegmentEnd = currentStart.plusDays(remainingDays - 1); + PlanSubDetailDO lastSegment = createBaseItem(original, currentStart, lastSegmentEnd); + lastSegment.setDesignNum(remainingDays); // 设置实际的designNum + segments.add(lastSegment); + } + + return segments; + } + + /** + * 创建分段对象(用于插活数据) + */ + private PlanSubDetailDO createSegment(PlanSubDetailDO original, LocalDateTime startDate, LocalDateTime endDate) { + PlanSubDetailDO segment = new PlanSubDetailDO(); + segment.setId(null); // 新分段id为空 + segment.setProjectPlanId(original.getProjectPlanId()); + segment.setProjectId(original.getProjectId()); + segment.setProjectPlanSubId(original.getId()); + segment.setProjectSubCode(original.getProjectSubCode()); + segment.setTwoDimOwner(Long.valueOf(original.getTwoDimOwner())); + segment.setProjectSubId(original.getProjectSubId()); + segment.setSubType(original.getSubType()); + segment.setName(original.getName()); + segment.setCode(original.getCode()); + segment.setStartTwoDimDate(startDate); + segment.setTwoDimDate(endDate); + // 只有id为空的才重新计算designNum + segment.setDesignNum(calculateWorkDays(startDate, endDate)); + return segment; + } + + /** + * 创建baseItem对象(用于baseList顺延) + */ + private PlanSubDetailDO createBaseItem(PlanSubDetailDO original, LocalDateTime startDate, LocalDateTime endDate) { + PlanSubDetailDO baseItem = new PlanSubDetailDO(); + // 复制原有属性 + baseItem.setId(original.getId()); + baseItem.setProjectPlanId(original.getProjectPlanId()); + baseItem.setProjectId(original.getProjectId()); + baseItem.setProjectPlanSubId(original.getProjectPlanSubId()); + baseItem.setProjectSubCode(original.getProjectSubCode()); + baseItem.setTwoDimOwner(original.getTwoDimOwner()); + baseItem.setProjectSubId(original.getProjectSubId()); + baseItem.setSubType(original.getSubType()); + baseItem.setName(original.getName()); + baseItem.setCode(original.getCode()); + baseItem.setDesignNum(calculateWorkDays(startDate, endDate)); + baseItem.setStartTwoDimDate(startDate); + baseItem.setTwoDimDate(endDate); + return baseItem; + } + + /** + * 获取时间段内的节假日 + */ + private List getHolidaysInRange(LocalDateTime startDate, LocalDateTime endDate, + List holidayList) { + return holidayList.stream() + .filter(holiday -> !holiday.isBefore(startDate) && !holiday.isAfter(endDate)) + .sorted() + .collect(Collectors.toList()); + } + + /** + * 计算工作天数(排除节假日) + */ + private Long calculateWorkDays(LocalDateTime startDate, LocalDateTime endDate) { + long workDays = 0; + LocalDateTime current = startDate.toLocalDate().atStartOfDay(); + LocalDateTime end = endDate.toLocalDate().atStartOfDay(); + + while (!current.isAfter(end)) { + // 检查是否是工作日 + workDays++; + current = current.plusDays(1); + } + + return workDays; + } + + /** + * 保存计划子明细 + */ + private void savePlanSubDetails(List resultList) { + for (PlanSubDetailDO item : resultList) { + if (item.getId() == null) { + // 新增 + planSubDetailMapper.insert(item); + } else { + // 更新 + planSubDetailMapper.updateById(item); + } + } + } + + @Override public CommonResult insertWork(PlanSubDetailSaveReqVO updateReqVO) { List list = updateReqVO.getList(); 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 index 66b20065..a601d55e 100644 --- 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 @@ -676,7 +676,7 @@ public class ProcessBomServiceImpl implements ProcessBomService { // if(vo.getMemo()!=null){ // vo.setMemo(vo.getMemo()+"→物料名称由"+po.getMaterialName()+"变为"+vo.getMaterialName()); // }else{ - change = true; + change = true; changeContent += "→物料名称由"+po.getMaterialName()+"变为"+vo.getMaterialName(); // } } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarService.java index a7c7249e..4a32437a 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarService.java @@ -14,7 +14,7 @@ public interface ShopCalendarService { * @return 物料 */ PageResult searchRl(ShopCalendarPageReqVO shopCalendarPageReqVO); - + Boolean searchHoliday(ShopCalendarPageReqVO shopCalendarPageReqVO); Boolean insert(String dates); Boolean updateRl(String ifjiejiari,String dates,String times); diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarServiceImpl.java index 84f35ac5..e5419f12 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/shopCalendar/ShopCalendarServiceImpl.java @@ -1,7 +1,11 @@ package com.chanko.yunxi.mes.module.heli.service.shopCalendar; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.module.heli.controller.admin.shopCalendar.vo.ShopCalendarPageReqVO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.shopCalendar.ShopCalendarDO; import com.chanko.yunxi.mes.module.heli.dal.mysql.shopCalendar.ShopCalendarMapper; @@ -9,9 +13,7 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.YearMonth; +import java.time.*; import java.time.format.DateTimeFormatter; import java.time.format.TextStyle; import java.util.*; @@ -40,6 +42,21 @@ public class ShopCalendarServiceImpl implements ShopCalendarService { return shopCalendarMapper.searchRl(shopCalendarPageReqVO); } + @Override + public Boolean searchHoliday(ShopCalendarPageReqVO shopCalendarPageReqVO) { + String queryDate = shopCalendarPageReqVO.getQueryDate(); + Long l = Long.valueOf(queryDate); + Instant instant = Instant.ofEpochMilli(l); + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + LocalDateTime startDate = localDateTime.with(LocalTime.MIN); + List aTrue = shopCalendarMapper.selectList(new LambdaQueryWrapperX().eq(ShopCalendarDO::getDates, startDate).eq(ShopCalendarDO::getIfjiejiari, "true")); + if (CollUtil.isNotEmpty(aTrue)){ + return false; + }else { + return true; + } + } + /*重置当月节假日*/ @Override diff --git a/mes-ui/mes-echarts/src/utils/requestConfig.js b/mes-ui/mes-echarts/src/utils/requestConfig.js index 522e9a92..1b24c638 100644 --- a/mes-ui/mes-echarts/src/utils/requestConfig.js +++ b/mes-ui/mes-echarts/src/utils/requestConfig.js @@ -1,4 +1,4 @@ -// const devBaseURL = 'http://localhost:5281' +const devBaseURL = 'http://localhost:8080' // const devBaseURL = 'http://5a35a48943.wicp.vip:40709' // const proBaseURL = 'http://5a35a48943.wicp.vip:40709' // const devBaseURL = 'http://124.221.23.100:9003' @@ -7,8 +7,8 @@ // const proBaseURL = 'http://118.195.155.9:9002/' // const devBaseURL = 'http://192.168.0.169:9002/' // const proBaseURL = 'http://192.168.0.169:9002/' -const devBaseURL = 'http://218.75.46.166:8889/' -const proBaseURL = 'http://218.75.46.166:8889/' +// const devBaseURL = 'http://218.75.46.166:8889/' +// const proBaseURL = 'http://218.75.46.166:8889/' export const BASE_URL = process.env.NODE_ENV === 'development' ? devBaseURL : proBaseURL export const TIMEOUT = 5000 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 index e5b6d1da..8fc4f641 100644 --- 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 @@ -28,6 +28,13 @@ export const getPlanSub = async (id: number) => { return await request.get({ url: `/heli/plan-sub/get?id=` + id }) } + +export const operate = async (data) => { + return await request.post({ url: `/heli/plan-sub/operate`, data }) +} + + + //插活保存 export const getOwnderPlanChaHuo = async (data) => { //return await request.post({ url: `/heli/plan-sub/postOwnderChaHuo`,data}) diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/plansubdetail/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/plansubdetail/index.ts index a60d02ba..fbcc0191 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/plansubdetail/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/plansubdetail/index.ts @@ -22,6 +22,13 @@ export const getPlanSubDetailPage = async (params) => { return await request.get({ url: `/heli/plan-sub-detail/page`, params }) } +export const pageAddList = async (params) => { + return await request.get({ url: `/heli/plan-sub-detail/pageAddList`, params }) +} +export const queryMaxDetail = async (params) => { + return await request.get({ url: `/heli/plan-sub-detail/queryMaxDetail`, params }) +} + // 查询生产计划子项目设计时间明细详情 export const getPlanSubDetail = async (id: number) => { return await request.get({ url: `/heli/plan-sub-detail/get?id=` + id }) @@ -36,7 +43,20 @@ export const createPlanSubDetail = async (data: PlanSubDetailVO) => { export const updatePlanSubDetail = async (data: PlanSubDetailVO) => { return await request.put({ url: `/heli/plan-sub-detail/update`, data }) } +export const modificationPlanSubDetail = async (data: PlanSubDetailVO) => { + return await request.post({ url: `/heli/plan-sub-detail/modification`, data }) +} +export const chahuoPlanSubDetail = async (data) => { + return await request.post({ url: `/heli/plan-sub-detail/chahuo`, data }) +} +export const savechahuoPlanSubDetail = async (data) => { + return await request.post({ url: `/heli/plan-sub-detail/savechahuo`, data }) +} + +export const operate = async (data) => { + return await request.post({ url: `/heli/plan-sub-detail/operate`, data }) +} // 删除生产计划子项目设计时间明细 export const deletePlanSubDetail = async (id: number) => { return await request.delete({ url: `/heli/plan-sub-detail/delete?id=` + id }) diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/shopCalendar/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/shopCalendar/index.ts index 0408c0e9..60d1fe27 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/shopCalendar/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/shopCalendar/index.ts @@ -12,7 +12,10 @@ export interface ShopCalendarVO { export const getShopCalendarPage = async (params) => { return await request.get({ url: `/heli/shopCalendar/searchRl`, params }) } - +// 查询日历 +export const isHoliday= async (params) => { + return await request.get({ url: `/heli/shopCalendar/searchHoliday`, params }) +} // 新增日历 export const createShopCalendarPlan = async (dates: string) => { return await request.post({ url: `/heli/shopCalendar/insert?dates=` + dates }) diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/hlvuestyle/shipmentsPrint.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/hlvuestyle/shipmentsPrint.vue index 56b62638..7cffc523 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/hlvuestyle/shipmentsPrint.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/hlvuestyle/shipmentsPrint.vue @@ -106,7 +106,7 @@ 制单人:{{ `` }} -客户联- -
+
- + - + - - - - - + + + + + - + - - - + + + - - - - - - - - - - - - - - - + + @@ -141,45 +178,385 @@ /> + + + + +
+ + +
+

{{ + dialogTitle + + '(当前:' + + formatDate(currentRow?.startTwoDimDate, 'YYYY-MM-DD') + + '至' + + formatDate(currentRow?.twoDimDate, 'YYYY-MM-DD') + + ')' + }}

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + 查询 + + + + + + + + + + + + + + + + + + + + diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue index 6ab12578..c3cb1617 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue @@ -3,7 +3,13 @@ - + @@ -421,8 +626,27 @@ v-model="scope.row.mouldId" clearable placeholder="下拉选择" disabled @@ -431,61 +655,144 @@ class="!w-265px" v-model="row.startBlankDate" type="date" value-format="x" - + - - - - - - - - + + + + - + @@ -494,8 +801,27 @@ v-for="dict in userInit" :key="dict.id" @@ -504,33 +830,77 @@ v-for="dict in userInit" :key="dict.id" - + - - + + - + @@ -553,8 +923,12 @@ v-for="dict in userInit" :key="dict.id" @@ -562,68 +936,152 @@ style="width: 100%" v-model="row.startDate" type="date" value-format="x" @@ -640,43 +1098,70 @@ v-for="dict in mergedArray7" :key="dict.id" - + - + - + - - - + + + - + - diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/printDialog.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/printDialog.vue index 941c6fcd..d312e78d 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/printDialog.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storagelog/printDialog.vue @@ -18,7 +18,7 @@ 取消 - + + + diff --git a/mes-ui/mini-app/src/uni_modules/le-dropdown/components/le-dropdown/le-dropdown.vue b/mes-ui/mini-app/src/uni_modules/le-dropdown/components/le-dropdown/le-dropdown.vue new file mode 100644 index 00000000..297d218c --- /dev/null +++ b/mes-ui/mini-app/src/uni_modules/le-dropdown/components/le-dropdown/le-dropdown.vue @@ -0,0 +1,629 @@ + + + + + diff --git a/mes-ui/mini-app/src/uni_modules/le-dropdown/components/le-dropdown/utils/hexToRgb.js b/mes-ui/mini-app/src/uni_modules/le-dropdown/components/le-dropdown/utils/hexToRgb.js new file mode 100644 index 00000000..ff3be766 --- /dev/null +++ b/mes-ui/mini-app/src/uni_modules/le-dropdown/components/le-dropdown/utils/hexToRgb.js @@ -0,0 +1,23 @@ +export default function(hexStr){ + //十六进制颜色值的正则表达式 + let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; + let sColor = hexStr.toLowerCase(); + if (sColor && reg.test(sColor)) { + if (sColor.length === 4) { + let sColorNew = "#"; + for (let i = 1; i < 4; i += 1) { + sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1)); + } + sColor = sColorNew; + } + //处理六位的颜色值f + let sColorChange = []; + for (let i = 1; i < 7; i += 2) { + sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`)); + } + let rgbText = sColorChange.join(",") + return rgbText; + } else { + return sColor; + } +} diff --git a/mes-ui/mini-app/src/utils/http.ts b/mes-ui/mini-app/src/utils/http.ts index 64815d61..7007ffcf 100644 --- a/mes-ui/mini-app/src/utils/http.ts +++ b/mes-ui/mini-app/src/utils/http.ts @@ -86,6 +86,7 @@ export const http = (options: UniApp.RequestOptions) => { ...options, // 响应成功 success(res) { + console.log(res) // 状态码 2xx, axios 就是这样设计的 if (res.statusCode >= 200 && res.statusCode < 300) { if (res.data?.code == 0) {