XiaoRuby
2023-09-01 8e39c9bbf8a8bb4707f2a766295b40497ae96706
production-server/src/main/java/com/yuanchu/mom/controller/ManufactureOrderController.java
@@ -6,6 +6,8 @@
import com.yuanchu.mom.pojo.dto.ManualTechnologyDto;
import com.yuanchu.mom.service.DeviceService;
import com.yuanchu.mom.service.ManualTechnologyService;
import com.yuanchu.mom.service.ManufactureSchedulingService;
import com.yuanchu.mom.utils.MyUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -39,11 +41,15 @@
    @Autowired
    private ManufactureOrderService manufactureOrderService;
    @Autowired
    private ManufactureSchedulingService manufactureSchedulingService;
    @Resource
    ManualTechnologyService manualTechnologyService;
    @Resource
    DeviceService deviceService;
    @ApiOperation(value = "查询生产订单列表")
    @ApiImplicitParams(value = {
@@ -72,6 +78,15 @@
        return Result.success(manualTechnologyService.seleDatil(manOrdId));
    }
    @ApiOperation(value = "点击查看排产")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "manOrdId", value = "生产订单id", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/select_Scheduling")
    public Result<?> selectScheduling(Integer manOrdId) {
        return Result.success(manufactureSchedulingService.selectScheduling(manOrdId));
    }
    @ApiOperation(value = "点击排产-->二级树选择设备")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "deviceGroup", value = "设备组", dataTypeClass = String.class, required = true)
@@ -82,28 +97,28 @@
    }
    @ApiOperation(value = "点击排产-->确定按钮")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "date", value = "排产开始日期", dataTypeClass = String.class, required = true),
            @ApiImplicitParam(name = "manOrdId", value = "生产订单Id", dataTypeClass = String.class, required = true),
            @ApiImplicitParam(name = "schedulingNumber", value = "排产数量", dataTypeClass = Integer.class, required = true),
    })
    @PostMapping("/output")
    public Result<?> output(@RequestParam(value = "date") @NotBlank(message = "排产开始日期不能为空") String date,
                            @RequestParam(value = "manOrdId") @NotNull(message = "生产订单Id不能为空") Integer manOrdId,
                            @RequestParam(value = "schedulingNumber") @NotNull(message = "排产数量不能为空") Integer schedulingNumber,
                            @Validated @RequestBody List<ManualTechnologyDto> manualTechnologyDtoList
    ) throws ParseException {
        manualTechnologyService.output(date, manOrdId, schedulingNumber, manualTechnologyDtoList);
        return Result.success("排产成功!");
    public Result<?> output(@Validated @RequestBody ManualTechnologyDto manualTechnologyDto) throws ParseException {
        // 判断输入数量是否超出
        Integer isExceed = manufactureOrderService.checkScheduled(manualTechnologyDto.getManOrdId(), manualTechnologyDto.getSchedulingNumber());
        if (isExceed >= 0){
            manualTechnologyService.output(manualTechnologyDto);
            return Result.success("排产成功!");
        } else {
            MyUtil.PrintLog(isExceed.toString());
            int i = manualTechnologyDto.getSchedulingNumber() + isExceed;
            return Result.fail("排产错误,当前剩余排产为:" + i);
        }
    }
    @ApiOperation(value = "下达")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "manOrdId", value = "生产订单id", dataTypeClass = Integer.class, required = true)
            @ApiImplicitParam(name = "manufactureOrderId", value = "订单id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "schedulingId", value = "排产Id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/down")
    public Result<?> down(Integer manOrdId) {
        manufactureOrderService.down(manOrdId);
    public Result<?> down(Integer manufactureOrderId, Integer schedulingId) {
        manufactureOrderService.down(manufactureOrderId, schedulingId);
        return Result.success("下达成功!");
    }