|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.op.mes.controller;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
@ -23,6 +24,7 @@ import com.op.mes.domain.*;
|
|
|
|
|
import com.op.mes.domain.dto.LineChartDto;
|
|
|
|
|
import com.op.mes.domain.dto.LineChartSeriesDto;
|
|
|
|
|
import com.op.mes.domain.dto.SysFactoryDto;
|
|
|
|
|
import com.op.mes.domain.vo.DynamicColumnVo;
|
|
|
|
|
import com.op.system.api.domain.DataSourcePropertyDTO;
|
|
|
|
|
import com.op.system.api.domain.SysUser;
|
|
|
|
|
import com.op.system.api.domain.device.EquEquipmentDTO;
|
|
|
|
@ -147,12 +149,12 @@ public class MesReportWorkController extends BaseController {
|
|
|
|
|
@RequiresPermissions("mes:reportWork:edit")
|
|
|
|
|
@PutMapping("/reportSap")
|
|
|
|
|
public AjaxResult reportSap(@RequestBody MesReportWork mesReportWork) {
|
|
|
|
|
R r = mesReportWorkService.reportSap(mesReportWork);
|
|
|
|
|
if(r.getCode()==200){
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}else{
|
|
|
|
|
return AjaxResult.error("报工失败:"+r.getMsg());
|
|
|
|
|
}
|
|
|
|
|
R r = mesReportWorkService.reportSap(mesReportWork);
|
|
|
|
|
if(r.getCode()==200){
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}else{
|
|
|
|
|
return AjaxResult.error("报工失败:"+r.getMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -384,124 +386,175 @@ public class MesReportWorkController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询人员列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getMesListUser")
|
|
|
|
|
public TableDataInfo getMesListUser(SysUser sysUser) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<SysUser> list = mesReportWorkService.getMesListUser(sysUser);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
@GetMapping("/getMachineProductionList")
|
|
|
|
|
public List<Map<String, Object>> getMachineProductionList(MesMachineReport mesMachineReport) {
|
|
|
|
|
List<DynamicColumnVo> proNames = this.getMachineProductionTitle(mesMachineReport);
|
|
|
|
|
mesMachineReport.setProductNames(proNames);
|
|
|
|
|
List<Map<String, Object>> list = mesReportWorkService.getMachineProductionList(mesMachineReport);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询工单列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getMesListWorkOrder")
|
|
|
|
|
public TableDataInfo getMesListWorkOrder(ProOrderWorkorderDTO proOrderWorkorderDTO) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<ProOrderWorkorderDTO> list = mesReportWorkService.getMesListWorkOrder(proOrderWorkorderDTO);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
@GetMapping("/getMachineProductionTitle")
|
|
|
|
|
public List<DynamicColumnVo> getMachineProductionTitle(MesMachineReport mesMachineReport) {
|
|
|
|
|
List<DynamicColumnVo> list = mesReportWorkService.getMachineProductionTitle(mesMachineReport);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询工线体列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getMesListEquip")
|
|
|
|
|
public TableDataInfo getMesListEquip(EquEquipmentDTO equEquipmentDTO) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<EquEquipmentDTO> list = mesReportWorkService.getMesListEquip(equEquipmentDTO);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
@PostMapping("/getMachineProductionExport")
|
|
|
|
|
public void getMachineProductionExport(HttpServletResponse response,MesMachineReport mesMachineReport) {
|
|
|
|
|
List<DynamicColumnVo> proNames = this.getMachineProductionTitle(mesMachineReport);
|
|
|
|
|
mesMachineReport.setProductNames(proNames);
|
|
|
|
|
List<Map<String, Object>> list = mesReportWorkService.getMachineProductionList(mesMachineReport);
|
|
|
|
|
|
|
|
|
|
@PutMapping("/getBatchList")
|
|
|
|
|
public List<ProOrderWorkorder> getBatchList(@RequestBody ProOrderWorkorder ProOrderWorkorder) {
|
|
|
|
|
return mesReportWorkService.getBatchList(ProOrderWorkorder);
|
|
|
|
|
}
|
|
|
|
|
String title = "表主题";
|
|
|
|
|
ArrayList<ExcelCol> excelCols = new ArrayList<>();
|
|
|
|
|
excelCols.add(new ExcelCol("日期","date",20));
|
|
|
|
|
for (DynamicColumnVo column : proNames) {
|
|
|
|
|
excelCols.add(new ExcelCol(column.getLabel(), column.getCode(), 20));
|
|
|
|
|
}
|
|
|
|
|
excelCols.add(new ExcelCol("总产量","totalQuantity",20));
|
|
|
|
|
|
|
|
|
|
/**获取母子报工记录(废弃)---改为:2.0查询各级报工详细列表**/
|
|
|
|
|
@RequiresPermissions("mes:reportWork:report")
|
|
|
|
|
@GetMapping("/getReportList")
|
|
|
|
|
public List getReportList(MesReportWork mesReportWork) {
|
|
|
|
|
List<MesReportWork> rlist = mesReportWorkService.getReportList(mesReportWork);
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
String titleName = "成型机产量统计报表";
|
|
|
|
|
SXSSFWorkbook workbook = null;
|
|
|
|
|
|
|
|
|
|
/**2.0查询各级报工详细列表**/
|
|
|
|
|
@RequiresPermissions("mes:reportWork:report")
|
|
|
|
|
@GetMapping("/getAllLevelReportList")
|
|
|
|
|
public List getAllLevelReportList(MesReportWork mesReportWork) {
|
|
|
|
|
List<MesReportWorkTabs> rlist = mesReportWorkService.getAllLevelReportList(mesReportWork);
|
|
|
|
|
return rlist;
|
|
|
|
|
try {
|
|
|
|
|
//设置响应头
|
|
|
|
|
response.setHeader("Content-disposition",
|
|
|
|
|
"attachment; filename="+ titleName);
|
|
|
|
|
response.setContentType("application/octet-stream;charset=UTF-8");
|
|
|
|
|
ServletOutputStream outputStream = response.getOutputStream();
|
|
|
|
|
//调用工具类
|
|
|
|
|
workbook = ExcelMapUtil.initWorkbook(titleName, null, excelCols, list);
|
|
|
|
|
workbook.write(outputStream);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}finally {
|
|
|
|
|
if (workbook!=null){
|
|
|
|
|
workbook.dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/submitReportPS")
|
|
|
|
|
public AjaxResult submitReportPS(@RequestBody List<MesReportWork> mesReportWorks) {
|
|
|
|
|
return toAjax(mesReportWorkService.submitReportPS(mesReportWorks));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查询人员列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getMesListUser")
|
|
|
|
|
public TableDataInfo getMesListUser(SysUser sysUser) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<SysUser> list = mesReportWorkService.getMesListUser(sysUser);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getPrepareList")
|
|
|
|
|
public List getPrepareList(MesPrepareDetail mesPrepareDetail) {
|
|
|
|
|
List<MesPrepareDetail> rlist = mesReportWorkService.getPrepareList(mesPrepareDetail);
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查询工单列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getMesListWorkOrder")
|
|
|
|
|
public TableDataInfo getMesListWorkOrder(ProOrderWorkorderDTO proOrderWorkorderDTO) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<ProOrderWorkorderDTO> list = mesReportWorkService.getMesListWorkOrder(proOrderWorkorderDTO);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**获取报工打印信息**/
|
|
|
|
|
@PutMapping("/getPutInOrderList")
|
|
|
|
|
public AjaxResult getPutInOrderList(@RequestBody MesReportWork mesReportWorks) {
|
|
|
|
|
return success(mesReportWorkService.getPutInOrderList(mesReportWorks));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查询工线体列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getMesListEquip")
|
|
|
|
|
public TableDataInfo getMesListEquip(EquEquipmentDTO equEquipmentDTO) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<EquEquipmentDTO> list = mesReportWorkService.getMesListEquip(equEquipmentDTO);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String args[]){
|
|
|
|
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
|
|
|
|
|
try {
|
|
|
|
|
Date start = dateFormat.parse("2023-10-12 09:00:00");
|
|
|
|
|
Date end = dateFormat.parse("2023-10-13 18:00:00");
|
|
|
|
|
@PutMapping("/getBatchList")
|
|
|
|
|
public List<ProOrderWorkorder> getBatchList(@RequestBody ProOrderWorkorder ProOrderWorkorder) {
|
|
|
|
|
return mesReportWorkService.getBatchList(ProOrderWorkorder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Calendar tempStart = Calendar.getInstance();
|
|
|
|
|
tempStart.setTime(start);
|
|
|
|
|
/**获取母子报工记录(废弃)---改为:2.0查询各级报工详细列表**/
|
|
|
|
|
@RequiresPermissions("mes:reportWork:report")
|
|
|
|
|
@GetMapping("/getReportList")
|
|
|
|
|
public List getReportList(MesReportWork mesReportWork) {
|
|
|
|
|
List<MesReportWork> rlist = mesReportWorkService.getReportList(mesReportWork);
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Calendar tempEnd = Calendar.getInstance();
|
|
|
|
|
tempEnd.setTime(end);
|
|
|
|
|
while (tempStart.before(tempEnd)) {
|
|
|
|
|
System.out.println(dateFormat.format(tempStart.getTime()));
|
|
|
|
|
tempStart.add(Calendar.HOUR_OF_DAY, 1);
|
|
|
|
|
/**2.0查询各级报工详细列表**/
|
|
|
|
|
@RequiresPermissions("mes:reportWork:report")
|
|
|
|
|
@GetMapping("/getAllLevelReportList")
|
|
|
|
|
public List getAllLevelReportList(MesReportWork mesReportWork) {
|
|
|
|
|
List<MesReportWorkTabs> rlist = mesReportWorkService.getAllLevelReportList(mesReportWork);
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/submitReportPS")
|
|
|
|
|
public AjaxResult submitReportPS(@RequestBody List<MesReportWork> mesReportWorks) {
|
|
|
|
|
return toAjax(mesReportWorkService.submitReportPS(mesReportWorks));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getPrepareList")
|
|
|
|
|
public List getPrepareList(MesPrepareDetail mesPrepareDetail) {
|
|
|
|
|
List<MesPrepareDetail> rlist = mesReportWorkService.getPrepareList(mesPrepareDetail);
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**获取报工打印信息**/
|
|
|
|
|
@PutMapping("/getPutInOrderList")
|
|
|
|
|
public AjaxResult getPutInOrderList(@RequestBody MesReportWork mesReportWorks) {
|
|
|
|
|
return success(mesReportWorkService.getPutInOrderList(mesReportWorks));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String args[]){
|
|
|
|
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
|
|
|
|
|
try {
|
|
|
|
|
Date start = dateFormat.parse("2023-10-12 09:00:00");
|
|
|
|
|
Date end = dateFormat.parse("2023-10-13 18:00:00");
|
|
|
|
|
|
|
|
|
|
Calendar tempStart = Calendar.getInstance();
|
|
|
|
|
tempStart.setTime(start);
|
|
|
|
|
|
|
|
|
|
Calendar tempEnd = Calendar.getInstance();
|
|
|
|
|
tempEnd.setTime(end);
|
|
|
|
|
while (tempStart.before(tempEnd)) {
|
|
|
|
|
System.out.println(dateFormat.format(tempStart.getTime()));
|
|
|
|
|
tempStart.add(Calendar.HOUR_OF_DAY, 1);
|
|
|
|
|
}
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**获取最新领料单**/
|
|
|
|
|
@PostMapping("/getNewPrepareData")
|
|
|
|
|
public List<MesPrepareDetailDTO> getNewPrepareData(@RequestBody MesPrepareDetail mesPrepareDetail) {
|
|
|
|
|
return mesReportWorkService.getNewPrepareData(mesPrepareDetail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**获取最新领料单**/
|
|
|
|
|
@PostMapping("/getNewPrepareData")
|
|
|
|
|
public List<MesPrepareDetailDTO> getNewPrepareData(@RequestBody MesPrepareDetail mesPrepareDetail) {
|
|
|
|
|
return mesReportWorkService.getNewPrepareData(mesPrepareDetail);
|
|
|
|
|
}
|
|
|
|
|
/**删除新增的报工物料组成**/
|
|
|
|
|
@DeleteMapping("/deleteBomRowNow/{id}")
|
|
|
|
|
public AjaxResult deleteBomRowNow(@PathVariable String id) {
|
|
|
|
|
return toAjax(mesReportWorkService.deleteBomRowNow(id));
|
|
|
|
|
}
|
|
|
|
|
@DeleteMapping("/deleteBomRowNow/{id}")
|
|
|
|
|
public AjaxResult deleteBomRowNow(@PathVariable String id) {
|
|
|
|
|
return toAjax(mesReportWorkService.deleteBomRowNow(id));
|
|
|
|
|
}
|
|
|
|
|
//获取仓库下拉列表
|
|
|
|
|
@GetMapping("/getWarehouseList")
|
|
|
|
|
public List<MesReportWorkConsume> getWarehouseList(MesReportWorkConsume workConsume) {
|
|
|
|
|
List<MesReportWorkConsume> rlist = mesReportWorkService.getWarehouseList(workConsume);
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
@PostMapping("/addDatasource")
|
|
|
|
|
public R addDatasource(@RequestBody DataSourcePropertyDTO dto){
|
|
|
|
|
DataSourceProperty dataSourceProperty = new DataSourceProperty();
|
|
|
|
|
BeanUtils.copyProperties(dto,dataSourceProperty);
|
|
|
|
|
dynamicDatasourceCreator.createDynamicDataSource(dataSourceProperty);
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
@GetMapping("/getWarehouseList")
|
|
|
|
|
public List<MesReportWorkConsume> getWarehouseList(MesReportWorkConsume workConsume) {
|
|
|
|
|
List<MesReportWorkConsume> rlist = mesReportWorkService.getWarehouseList(workConsume);
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/removeDatasource")
|
|
|
|
|
public R removeDatasource(@RequestBody DataSourcePropertyDTO dto){
|
|
|
|
|
DataSourceProperty dataSourceProperty = new DataSourceProperty();
|
|
|
|
|
BeanUtils.copyProperties(dto,dataSourceProperty);
|
|
|
|
|
dynamicRoutingDataSource.removeDataSource(dataSourceProperty.getPoolName());
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
@PostMapping("/addDatasource")
|
|
|
|
|
public R addDatasource(@RequestBody DataSourcePropertyDTO dto){
|
|
|
|
|
DataSourceProperty dataSourceProperty = new DataSourceProperty();
|
|
|
|
|
BeanUtils.copyProperties(dto,dataSourceProperty);
|
|
|
|
|
dynamicDatasourceCreator.createDynamicDataSource(dataSourceProperty);
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/removeDatasource")
|
|
|
|
|
public R removeDatasource(@RequestBody DataSourcePropertyDTO dto){
|
|
|
|
|
DataSourceProperty dataSourceProperty = new DataSourceProperty();
|
|
|
|
|
BeanUtils.copyProperties(dto,dataSourceProperty);
|
|
|
|
|
dynamicRoutingDataSource.removeDataSource(dataSourceProperty.getPoolName());
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|