|
|
|
@ -1,21 +1,11 @@
|
|
|
|
package cn.iocoder.yudao.module.mes.controller.admin.task;
|
|
|
|
package cn.iocoder.yudao.module.mes.controller.admin.task;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.bom.vo.BomSaveReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanRespVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanRespVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.task.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.task.vo.TaskPlanParam;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.plan.PlanDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.plan.PlanDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.task.TaskDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.task.TaskDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.task.TaskDetailDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.task.ViewTaskProductSummary;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.bom.BomService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.bom.BomService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.itemrequisition.ItemAnalysisService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.itemrequisition.ItemAnalysisService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.itemrequisition.entity.ItemRequisitionAndStock;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.itemrequisition.entity.ItemRequisitionAndStock;
|
|
|
|
@ -24,20 +14,19 @@ import cn.iocoder.yudao.module.mes.service.task.TaskService;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
import javax.validation.Valid;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
|
|
|
|
|
|
@Tag(name = "管理后台 - 生产任务单")
|
|
|
|
@Tag(name = "管理后台 - 生产任务单")
|
|
|
|
@ -73,6 +62,7 @@ public class TaskItemNeedController {
|
|
|
|
List<ItemRequisitionAndStock> list = itemAnalysisService.getItemAnalysis(task);
|
|
|
|
List<ItemRequisitionAndStock> list = itemAnalysisService.getItemAnalysis(task);
|
|
|
|
return success(list);
|
|
|
|
return success(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/item-need/plan")
|
|
|
|
@GetMapping("/item-need/plan")
|
|
|
|
@Operation(summary = "获得生产计划所需物料")
|
|
|
|
@Operation(summary = "获得生产计划所需物料")
|
|
|
|
@Parameter(name = "planId", description = "计划编号", required = true)
|
|
|
|
@Parameter(name = "planId", description = "计划编号", required = true)
|
|
|
|
@ -81,6 +71,7 @@ public class TaskItemNeedController {
|
|
|
|
List<ItemRequisitionAndStock> list = itemAnalysisService.getItemAnalysis(plan);
|
|
|
|
List<ItemRequisitionAndStock> list = itemAnalysisService.getItemAnalysis(plan);
|
|
|
|
return success(list);
|
|
|
|
return success(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/item-need/product")
|
|
|
|
@GetMapping("/item-need/product")
|
|
|
|
@Operation(summary = "获得某产品数量所需物料数量")
|
|
|
|
@Operation(summary = "获得某产品数量所需物料数量")
|
|
|
|
@Parameter(name = "productId", description = "任务编号", required = true)
|
|
|
|
@Parameter(name = "productId", description = "任务编号", required = true)
|
|
|
|
@ -93,7 +84,7 @@ public class TaskItemNeedController {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 对生产任务单进行计划,以每个计划的产品数优先排产ProductsOfPlan
|
|
|
|
* 对生产任务单进行计划,以每个计划的产品数优先排产ProductsOfPlan
|
|
|
|
* 排出的计划数超过选定的天数,则后续计划堆积在最后一天
|
|
|
|
* 排出的计划数超过选定的天数,则后续计划堆积在最后一天
|
|
|
|
* **/
|
|
|
|
**/
|
|
|
|
@GetMapping("/generate-plan/byTask")
|
|
|
|
@GetMapping("/generate-plan/byTask")
|
|
|
|
@Operation(summary = "对生产任务单进行计划")
|
|
|
|
@Operation(summary = "对生产任务单进行计划")
|
|
|
|
public CommonResult<List<PlanRespVO>> generatePlanByTask(@Valid TaskPlanParam planParam) {
|
|
|
|
public CommonResult<List<PlanRespVO>> generatePlanByTask(@Valid TaskPlanParam planParam) {
|
|
|
|
@ -129,6 +120,7 @@ public class TaskItemNeedController {
|
|
|
|
|
|
|
|
|
|
|
|
return success(planService.buildVOList(list));
|
|
|
|
return success(planService.buildVOList(list));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//根据下标取值返回日期天数,如果下标超出则返回最后一天,如果不给定日期,则默认从今天开始
|
|
|
|
//根据下标取值返回日期天数,如果下标超出则返回最后一天,如果不给定日期,则默认从今天开始
|
|
|
|
private LocalDateTime getNextDate(int index, LocalDateTime[] dateTimes) {
|
|
|
|
private LocalDateTime getNextDate(int index, LocalDateTime[] dateTimes) {
|
|
|
|
if (dateTimes == null) return LocalDateTime.now().plusDays(index);
|
|
|
|
if (dateTimes == null) return LocalDateTime.now().plusDays(index);
|
|
|
|
|