package com.yuanchu.mom.controller;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
import com.yuanchu.mom.service.ManufactureOrderService;
|
|
import javax.annotation.Resource;
|
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotNull;
|
import java.text.ParseException;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
|
/**
|
* 生产订单表(ManufactureOrder)表控制层
|
*
|
* @author zss
|
* @since 2023-08-17 14:16:24
|
*/
|
@Api(tags = "生产管理-->生产订单")
|
@RestController
|
@RequestMapping("/manufactureOrder")
|
public class ManufactureOrderController {
|
|
@Autowired
|
private ManufactureOrderService manufactureOrderService;
|
|
@Autowired
|
private ManufactureSchedulingService manufactureSchedulingService;
|
|
@Resource
|
ManualTechnologyService manualTechnologyService;
|
|
@Resource
|
DeviceService deviceService;
|
|
|
@ApiOperation(value = "查询生产订单列表")
|
@ApiImplicitParams(value = {
|
@ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true),
|
@ApiImplicitParam(name = "countSize", value = "条数/页", dataTypeClass = Integer.class, required = true),
|
@ApiImplicitParam(name = "downTime", value = "下单日期", dataTypeClass = String.class),
|
@ApiImplicitParam(name = "delTime", value = "交货日期", dataTypeClass = String.class),
|
@ApiImplicitParam(name = "customerCode", value = "合同编号", dataTypeClass = String.class),
|
@ApiImplicitParam(name = "type", value = "状态(为空=全部)", dataTypeClass = Integer.class)
|
})
|
@GetMapping("/selectAllManord")
|
public Result selectAllManord(int pageSize, int countSize, String downTime, String delTime, String customerCode, Integer type) {
|
IPage<Map<String, Object>> manufactureOrderPage = manufactureOrderService.selectAllManord(new Page<Object>(pageSize, countSize), downTime, delTime, customerCode, type);
|
Map<String, Object> map = new HashMap<>();
|
map.put("total", manufactureOrderPage.getTotal());
|
map.put("row", manufactureOrderPage.getRecords());
|
return Result.success(map);
|
}
|
|
@ApiOperation(value = "点击排产获取表格二级树")
|
@ApiImplicitParams(value = {
|
@ApiImplicitParam(name = "manOrdId", value = "生产订单id", dataTypeClass = Integer.class, required = true)
|
})
|
@GetMapping("/seleDatil")
|
public Result seleDatil(Integer manOrdId) {
|
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)
|
})
|
@GetMapping("/seleDevice")
|
public Result seleDevice(String deviceGroup) {
|
return Result.success(deviceService.getDeviceNameByGroup(deviceGroup));
|
}
|
|
@ApiOperation(value = "点击排产-->确定按钮")
|
@PostMapping("/output")
|
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 = "manufactureOrderId", value = "订单id", dataTypeClass = Integer.class, required = true),
|
@ApiImplicitParam(name = "schedulingId", value = "排产Id", dataTypeClass = Integer.class, required = true)
|
})
|
@PostMapping("/down")
|
public Result<?> down(Integer manufactureOrderId, Integer schedulingId) {
|
manufactureOrderService.down(manufactureOrderId, schedulingId);
|
return Result.success("下达成功!");
|
}
|
|
@ApiOperation(value = "多选删除")
|
@ApiImplicitParams(value = {
|
@ApiImplicitParam(name = "manOrdId", value = "生产订单id", dataTypeClass = String.class, dataType = "list", required = true)
|
})
|
@DeleteMapping("/delete")
|
public Result<?> deleteManufacture(List<String> manOrdId) {
|
manufactureOrderService.deleteManufacture(manOrdId);
|
return Result.success("删除成功!");
|
}
|
}
|