package com.chinaztt.mes.aps.controller;
|
|
import com.chinaztt.mes.aps.core.ApsMain;
|
import com.chinaztt.mes.aps.dto.OrderDTO;
|
import com.chinaztt.mes.aps.service.ApsCoreService;
|
import com.chinaztt.mes.aps.vo.GanttTaskVo;
|
import com.chinaztt.ztt.common.core.util.R;
|
import com.chinaztt.ztt.common.log.annotation.SysLog;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.AllArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.math.BigDecimal;
|
import java.time.LocalDate;
|
import java.util.List;
|
|
/**
|
* @Author: zhangxy
|
* @Date: 2020-10-14 9:58
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/aps/main")
|
public class ApsMainController {
|
|
private ApsMain apsMain;
|
private ApsCoreService apsCoreService;
|
|
|
/**
|
* 加载甘特图数据
|
*
|
* @param sceneId
|
* @param groupId
|
* @param viewStart
|
* @param viewEnd
|
* @return
|
*/
|
@ApiOperation(value = "加载甘特图", notes = "加载甘特图")
|
@GetMapping
|
public R get(Long sceneId, Long groupId, LocalDate viewStart, LocalDate viewEnd) {
|
return R.ok(apsCoreService.query(sceneId, groupId, viewStart, viewEnd.plusDays(1)));
|
}
|
|
/**
|
* 加载甘特图数据
|
*
|
* @param sceneId
|
* @param workStationList
|
* @param viewStart
|
* @param viewEnd
|
* @param stateList
|
* @return
|
*/
|
@ApiOperation(value = "加载甘特图", notes = "加载甘特图")
|
@GetMapping("/loadGantt")
|
public R get(Long sceneId, @RequestParam(value = "workStationList", required = false) List<Long> workStationList, String workCenter
|
, LocalDate viewStart, LocalDate viewEnd, @RequestParam(value = "stateList", required = false) List<String> stateList) {
|
return R.ok(apsCoreService.loadGantt(sceneId, workStationList, workCenter, viewStart, viewEnd.plusDays(1), stateList));
|
}
|
|
/**
|
* 运行排产
|
*
|
* @param orders
|
* @return
|
*/
|
@ApiOperation(value = "执行订单排产", notes = "执行订单排产")
|
@PostMapping("/run/{sceneId}")
|
public R run(@RequestBody OrderDTO[] orders, @PathVariable Long sceneId) {
|
return apsMain.run(orders, sceneId);
|
}
|
|
/**
|
* 修改排产
|
*
|
* @param task
|
* @return
|
*/
|
@ApiOperation(value = "修改排产", notes = "修改排产")
|
@SysLog("修改排产")
|
@PutMapping
|
public R updateById(@RequestBody GanttTaskVo task) {
|
return R.ok(apsCoreService.updateTaskById(task));
|
}
|
|
/**
|
* 根据机台计算开始结束时间
|
*
|
* @return
|
*/
|
@ApiOperation(value = "计算开始结束时间", notes = "计算开始结束时间")
|
@SysLog("计算开始结束时间")
|
@GetMapping("/calOperationTaskTime")
|
public R calOperationTaskTime(Long workstationId, Long partId, BigDecimal qty) {
|
return R.ok(apsCoreService.calOperationTaskTime(workstationId, partId, qty));
|
}
|
|
/**
|
* 根据机台计算开始结束时间
|
*
|
* @return
|
*/
|
@ApiOperation(value = "自动选择机台", notes = "自动选择机台")
|
@SysLog("自动选择机台")
|
@GetMapping("/autoSetTime")
|
public R autoSetTime(String workCenter, Long partId, BigDecimal qty) {
|
return R.ok(apsCoreService.autoSetTime(workCenter, partId, qty));
|
}
|
|
/**
|
* 删除排产
|
*
|
* @param id
|
* @return
|
*/
|
@ApiOperation(value = "通过id删除排产", notes = "通过id删除排产")
|
@SysLog("通过id删除排产")
|
@DeleteMapping("/{id}")
|
public R removeById(@PathVariable Long id) {
|
return R.ok(apsCoreService.removeSceneTask(id));
|
}
|
|
|
/**
|
* 应用至实际场景
|
*
|
* @param sceneId
|
* @return
|
*/
|
@ApiOperation(value = "应用至实际场景", notes = "应用至实际场景")
|
@SysLog("应用至实际场景")
|
@PostMapping("/apply/{sceneId}")
|
public R apply(@PathVariable Long sceneId) {
|
return apsCoreService.applyToReality(sceneId);
|
}
|
|
|
}
|