package com.ruoyi.production.controller;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.framework.web.domain.R;
|
import com.ruoyi.production.dto.ProductionProductMainDetailExportDto;
|
import com.ruoyi.production.dto.ProductionProductMainDto;
|
import com.ruoyi.production.dto.ProductionProductMainSummaryExportDto;
|
import com.ruoyi.production.dto.ProductionReportDailySummaryDto;
|
import com.ruoyi.production.dto.ProductionReportStateDto;
|
import com.ruoyi.production.pojo.ProductionProductMain;
|
import com.ruoyi.production.service.ProductionProductMainService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.time.LocalDate;
|
import java.util.List;
|
|
@RequestMapping("productionProductMain")
|
@RestController
|
@Api(value = "生产报工")
|
public class ProductionProductMainController {
|
|
@Autowired
|
private ProductionProductMainService productionProductMainService;
|
|
/**
|
* 报工查询
|
*
|
* @param page
|
* @param productionProductMainDto
|
* @return
|
*/
|
@ApiOperation("报工台账汇总分页")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "current", value = "页码", dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "size", value = "每页数量", dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "workOrderNo", value = "工单编号(模糊)", dataType = "string", paramType = "query"),
|
@ApiImplicitParam(name = "workOrderStatus", value = "工单状态", dataType = "string", paramType = "query")
|
})
|
@GetMapping("listPage")
|
public R<?> page(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) {
|
return R.ok(productionProductMainService.listPageProductionProductMainDto(page, productionProductMainDto));
|
}
|
|
/**
|
* 报工明细查询(每条报工记录)
|
*/
|
@ApiOperation("报工明细分页(每条报工记录)")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "current", value = "页码", dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "size", value = "每页数量", dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "workOrderId", value = "工单ID", dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "startDate", value = "开始日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query"),
|
@ApiImplicitParam(name = "endDate", value = "结束日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query")
|
})
|
@GetMapping("listPageDetail")
|
public R<?> pageDetail(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) {
|
return R.ok(productionProductMainService.listPageProductionProductMainDetailDto(page, productionProductMainDto));
|
}
|
|
|
/**
|
* 报工新增更新
|
*
|
* @param productionProductMainDto
|
* @return
|
*/
|
@PostMapping("addProductMain")
|
public R<?> addProductMain(@RequestBody ProductionProductMainDto productionProductMainDto) {
|
return R.ok(productionProductMainService.addProductMain(productionProductMainDto));
|
}
|
|
/**
|
* 扫码后查询当前用户是否存在进行中的报工
|
*/
|
@ApiOperation("查询进行中的报工(当前登录人)")
|
@GetMapping("getRunning")
|
public R<ProductionProductMain> getRunning(Long workOrderId, Long productProcessRouteItemId) {
|
ProductionProductMain productionProductMain = productionProductMainService.getRunning(workOrderId, productProcessRouteItemId);
|
return R.ok(productionProductMain);
|
}
|
|
/**
|
* 每日报工时长汇总(当前登录人)
|
*/
|
@ApiOperation("每日报工时长汇总(当前登录人)")
|
@GetMapping("dailyDuration")
|
public R<List<ProductionReportDailySummaryDto>> dailyDuration(Long workOrderId, Long productProcessRouteItemId, LocalDate startDate, LocalDate endDate) {
|
return R.ok(productionProductMainService.dailyDuration(workOrderId, productProcessRouteItemId, startDate, endDate));
|
}
|
|
/**
|
* 查询报工状态: 1-开始报工 2-结束报工 3-报工完成
|
*/
|
@ApiOperation("查询报工状态(当前登录人)")
|
@GetMapping("reportState")
|
public R<ProductionReportStateDto> reportState(Long workOrderId, Long productProcessRouteItemId) {
|
return R.ok(productionProductMainService.reportState(workOrderId, productProcessRouteItemId));
|
}
|
|
@ApiOperation("删除报工")
|
@DeleteMapping("/delete")
|
public R<?> delete(@RequestBody ProductionProductMainDto productionProductMainDto) {
|
return R.ok(productionProductMainService.removeProductMain(productionProductMainDto.getId()));
|
}
|
|
|
/**
|
* 报工台账汇总导出
|
*/
|
@ApiOperation("报工台账汇总导出")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "workOrderIds", value = "工单ID列表, 可传多个", allowMultiple = true, dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "workOrderNo", value = "工单编号(模糊)", dataType = "string", paramType = "query"),
|
@ApiImplicitParam(name = "workOrderStatus", value = "工单状态", dataType = "string", paramType = "query")
|
})
|
@PostMapping("/export")
|
public void export(HttpServletResponse response, ProductionProductMainDto productionProductMainDto) {
|
List<ProductionProductMainSummaryExportDto> list = productionProductMainService.listSummaryExportData(productionProductMainDto);
|
ExcelUtil<ProductionProductMainSummaryExportDto> util = new ExcelUtil<>(ProductionProductMainSummaryExportDto.class);
|
util.exportExcel(response, list, "生产报工汇总数据");
|
}
|
|
/**
|
* 报工明细导出
|
*/
|
@ApiOperation("报工明细导出")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "workOrderIds", value = "工单ID列表, 可传多个", allowMultiple = true, dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "workOrderId", value = "工单ID", dataType = "long", paramType = "query"),
|
@ApiImplicitParam(name = "startDate", value = "开始日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query"),
|
@ApiImplicitParam(name = "endDate", value = "结束日期(按结束时间过滤, yyyy-MM-dd)", dataType = "string", paramType = "query")
|
})
|
@PostMapping("/exportDetail")
|
public void exportDetail(HttpServletResponse response, ProductionProductMainDto productionProductMainDto) {
|
List<ProductionProductMainDetailExportDto> list = productionProductMainService.listDetailExportData(productionProductMainDto);
|
ExcelUtil<ProductionProductMainDetailExportDto> util = new ExcelUtil<>(ProductionProductMainDetailExportDto.class);
|
util.exportExcel(response, list, "生产报工明细数据");
|
}
|
}
|