设备数据采集页面
This commit is contained in:
parent
d9adff9c69
commit
68babc5786
@ -0,0 +1,95 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.configuration;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.configuration.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.configuration.ConfigurationDO;
|
||||
import com.chanko.yunxi.mes.module.heli.service.configuration.ConfigurationService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备配置")
|
||||
@RestController
|
||||
@RequestMapping("/heli/configuration")
|
||||
@Validated
|
||||
public class ConfigurationController {
|
||||
|
||||
@Resource
|
||||
private ConfigurationService configurationService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备配置")
|
||||
@PreAuthorize("@ss.hasPermission('heli:configuration:create')")
|
||||
public CommonResult<Long> createConfiguration(@Valid @RequestBody ConfigurationSaveReqVO createReqVO) {
|
||||
return success(configurationService.createConfiguration(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备配置")
|
||||
@PreAuthorize("@ss.hasPermission('heli:configuration:update')")
|
||||
public CommonResult<Boolean> updateConfiguration(@Valid @RequestBody ConfigurationSaveReqVO updateReqVO) {
|
||||
configurationService.updateConfiguration(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('heli:configuration:delete')")
|
||||
public CommonResult<Boolean> deleteConfiguration(@RequestParam("id") Long id) {
|
||||
configurationService.deleteConfiguration(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('heli:configuration:query')")
|
||||
public CommonResult<ConfigurationRespVO> getConfiguration(@RequestParam("id") Long id) {
|
||||
ConfigurationDO configuration = configurationService.getConfiguration(id);
|
||||
return success(BeanUtils.toBean(configuration, ConfigurationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('heli:configuration:query')")
|
||||
public CommonResult<PageResult<ConfigurationRespVO>> getConfigurationPage(@Valid ConfigurationPageReqVO pageReqVO) {
|
||||
PageResult<ConfigurationDO> pageResult = configurationService.getConfigurationPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ConfigurationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('heli:configuration:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportConfigurationExcel(@Valid ConfigurationPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ConfigurationDO> list = configurationService.getConfigurationPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备配置.xls", "数据", ConfigurationRespVO.class,
|
||||
BeanUtils.toBean(list, ConfigurationRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.configuration.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 设备配置分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ConfigurationPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "设备编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "主轴转速下限")
|
||||
private Integer speedOfMainshaftLower;
|
||||
|
||||
@Schema(description = "主轴转速上限")
|
||||
private Integer speedOfMainshaftUpper;
|
||||
|
||||
@Schema(description = "进给速度下限")
|
||||
private Integer feedSpeedLower;
|
||||
|
||||
@Schema(description = "进给速度上限")
|
||||
private Integer feedSpeedUpper;
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.configuration.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ConfigurationRespVO {
|
||||
|
||||
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "5985")
|
||||
@ExcelProperty("自增字段,唯一")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备编码")
|
||||
@ExcelProperty("设备编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "主轴转速下限")
|
||||
@ExcelProperty("主轴转速下限")
|
||||
private Integer speedOfMainshaftLower;
|
||||
|
||||
@Schema(description = "主轴转速上限")
|
||||
@ExcelProperty("主轴转速上限")
|
||||
private Integer speedOfMainshaftUpper;
|
||||
|
||||
@Schema(description = "进给速度下限")
|
||||
@ExcelProperty("进给速度下限")
|
||||
private Integer feedSpeedLower;
|
||||
|
||||
@Schema(description = "进给速度上限")
|
||||
@ExcelProperty("进给速度上限")
|
||||
private Integer feedSpeedUpper;
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.configuration.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class ConfigurationSaveReqVO {
|
||||
|
||||
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "5985")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "主轴转速下限")
|
||||
private Integer speedOfMainshaftLower;
|
||||
|
||||
@Schema(description = "主轴转速上限")
|
||||
private Integer speedOfMainshaftUpper;
|
||||
|
||||
@Schema(description = "进给速度下限")
|
||||
private Integer feedSpeedLower;
|
||||
|
||||
@Schema(description = "进给速度上限")
|
||||
private Integer feedSpeedUpper;
|
||||
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition;
|
||||
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.dataacquisition.DataAcquisitionDO;
|
||||
import com.chanko.yunxi.mes.module.heli.service.dataacquisition.DataAcquisitionService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备数据采集")
|
||||
@RestController
|
||||
@RequestMapping("/heli/data-acquisition")
|
||||
@Validated
|
||||
public class DataAcquisitionController {
|
||||
|
||||
@Resource
|
||||
private DataAcquisitionService dataAcquisitionService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备数据采集")
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:create')")
|
||||
public CommonResult<Long> createDataAcquisition(@Valid @RequestBody DataAcquisitionSaveReqVO createReqVO) {
|
||||
return success(dataAcquisitionService.createDataAcquisition(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备数据采集")
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:update')")
|
||||
public CommonResult<Boolean> updateDataAcquisition(@Valid @RequestBody DataAcquisitionSaveReqVO updateReqVO) {
|
||||
dataAcquisitionService.updateDataAcquisition(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备数据采集")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:delete')")
|
||||
public CommonResult<Boolean> deleteDataAcquisition(@RequestParam("id") Long id) {
|
||||
dataAcquisitionService.deleteDataAcquisition(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备数据采集")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:query')")
|
||||
public CommonResult<DataAcquisitionRespVO> getDataAcquisition(@RequestParam("id") Long id) {
|
||||
DataAcquisitionDO dataAcquisition = dataAcquisitionService.getDataAcquisition(id);
|
||||
return success(BeanUtils.toBean(dataAcquisition, DataAcquisitionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备数据采集分页")
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:query')")
|
||||
public CommonResult<PageResult<DataAcquisitionRespVO>> getDataAcquisitionPage(@Valid DataAcquisitionPageReqVO pageReqVO) {
|
||||
PageResult<DataAcquisitionDO> pageResult = dataAcquisitionService.getDataAcquisitionPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DataAcquisitionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备数据采集 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDataAcquisitionExcel(@Valid DataAcquisitionPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DataAcquisitionDO> list = dataAcquisitionService.getDataAcquisitionPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备数据采集.xls", "数据", DataAcquisitionRespVO.class,
|
||||
BeanUtils.toBean(list, DataAcquisitionRespVO.class));
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0/5 * * * * ?")
|
||||
public void updateDataCollection(){
|
||||
dataAcquisitionService.updateDataCollection();
|
||||
}
|
||||
@GetMapping("/getList")
|
||||
@Operation(summary = "获得设备数据采集")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:query')")
|
||||
public CommonResult<List<DataAcquisitionDO>> getList() {
|
||||
List<DataAcquisitionDO> dataAcquisition = dataAcquisitionService.getList();
|
||||
return success(dataAcquisition);
|
||||
}
|
||||
@GetMapping("/getDataAcquisitionList")
|
||||
@Operation(summary = "获得设备")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('heli:data-acquisition:query')")
|
||||
public CommonResult<List<DataAcquisitionDO>> getDataAcquisitionList(@RequestParam("code") String code) {
|
||||
List<DataAcquisitionDO> dataAcquisition = dataAcquisitionService.getDataAcquisitionList(code);
|
||||
return success(dataAcquisition);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 设备数据采集分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DataAcquisitionPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "设备编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "程序号")
|
||||
private String programNumber;
|
||||
|
||||
@Schema(description = "刀具号")
|
||||
private Integer toolNumber;
|
||||
|
||||
@Schema(description = "运行时长")
|
||||
private String runningDuration;
|
||||
|
||||
@Schema(description = "运行状态", example = "2")
|
||||
private String runningStatus;
|
||||
|
||||
@Schema(description = "主轴转速")
|
||||
private String speedOfMainshaft;
|
||||
|
||||
@Schema(description = "进给速度")
|
||||
private String feedSpeed;
|
||||
|
||||
@Schema(description = "查询状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备数据采集 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DataAcquisitionRespVO {
|
||||
|
||||
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "27287")
|
||||
@ExcelProperty("自增字段,唯一")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备编码")
|
||||
@ExcelProperty("设备编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "程序号")
|
||||
@ExcelProperty("程序号")
|
||||
private String programNumber;
|
||||
|
||||
@Schema(description = "刀具号")
|
||||
@ExcelProperty("刀具号")
|
||||
private Integer toolNumber;
|
||||
|
||||
@Schema(description = "运行时长")
|
||||
@ExcelProperty("运行时长")
|
||||
private String runningDuration;
|
||||
|
||||
@Schema(description = "运行状态", example = "2")
|
||||
@ExcelProperty("运行状态")
|
||||
private String runningStatus;
|
||||
|
||||
@Schema(description = "主轴转速")
|
||||
@ExcelProperty("主轴转速")
|
||||
private String speedOfMainshaft;
|
||||
|
||||
@Schema(description = "进给速度")
|
||||
@ExcelProperty("进给速度")
|
||||
private String feedSpeed;
|
||||
|
||||
@Schema(description = "查询状态", example = "1")
|
||||
@ExcelProperty("查询状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备数据采集新增/修改 Request VO")
|
||||
@Data
|
||||
public class DataAcquisitionSaveReqVO {
|
||||
|
||||
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "27287")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "程序号")
|
||||
private String programNumber;
|
||||
|
||||
@Schema(description = "刀具号")
|
||||
private Integer toolNumber;
|
||||
|
||||
@Schema(description = "运行时长")
|
||||
private String runningDuration;
|
||||
|
||||
@Schema(description = "运行状态", example = "2")
|
||||
private String runningStatus;
|
||||
|
||||
@Schema(description = "主轴转速")
|
||||
private String speedOfMainshaft;
|
||||
|
||||
@Schema(description = "进给速度")
|
||||
private String feedSpeed;
|
||||
|
||||
@Schema(description = "查询状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -99,9 +99,9 @@ public class OrderYfController {
|
||||
}else {
|
||||
BigDecimal subtract = cgYf.subtract(cgYifu);
|
||||
if (subtract.compareTo(BigDecimal.ZERO) < 0){
|
||||
order.setSYAmount(BigDecimal.ZERO);
|
||||
order.setCgSY(BigDecimal.ZERO);
|
||||
}else {
|
||||
order.setSYAmount(subtract);
|
||||
order.setCgSY(subtract);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(amount)){
|
||||
|
||||
@ -178,5 +178,11 @@ public class StorageLogController {
|
||||
PageResult<StorageLogNowDO> pageResult = storageLogService.getSupplementPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@PostMapping("/submitForm")
|
||||
@Operation(summary = "生产导入新中大")
|
||||
@PreAuthorize("@ss.hasPermission('heli:storage-log:update')")
|
||||
public CommonResult<Boolean> submitForm( @RequestBody List<StorageLogDO> list) {
|
||||
storageLogService.submitForm(list);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,5 +52,7 @@ public class StorageLogPageReqVO extends PageParam {
|
||||
private Long headerId;
|
||||
@Schema(description = "单据编号")
|
||||
private String codeNo;
|
||||
@Schema(description = "获取物料信息id")
|
||||
private List<Long> ids;
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.dataobject.configuration;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 设备配置 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("equipment_configuration")
|
||||
@KeySequence("equipment_configuration_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConfigurationDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 自增字段,唯一
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 主轴转速下限
|
||||
*/
|
||||
private Integer speedOfMainshaftLower;
|
||||
/**
|
||||
* 主轴转速上限
|
||||
*/
|
||||
private Integer speedOfMainshaftUpper;
|
||||
/**
|
||||
* 进给速度下限
|
||||
*/
|
||||
private Integer feedSpeedLower;
|
||||
/**
|
||||
* 进给速度上限
|
||||
*/
|
||||
private Integer feedSpeedUpper;
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.dataobject.dataacquisition;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 设备数据采集 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("equipment_data_acquisition")
|
||||
@KeySequence("equipment_data_acquisition_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DataAcquisitionDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 自增字段,唯一
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 程序号
|
||||
*/
|
||||
private String programNumber;
|
||||
/**
|
||||
* 刀具号
|
||||
*/
|
||||
private Integer toolNumber;
|
||||
/**
|
||||
* 运行时长
|
||||
*/
|
||||
private String runningDuration;
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
private String runningStatus;
|
||||
/**
|
||||
* 主轴转速
|
||||
*/
|
||||
private String speedOfMainshaft;
|
||||
/**
|
||||
* 进给速度
|
||||
*/
|
||||
private String feedSpeed;
|
||||
/**
|
||||
* 查询状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer speedOfMainshaftLower;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer speedOfMainshaftUpper;
|
||||
@TableField(exist = false)
|
||||
private Integer feedSpeedLower;
|
||||
@TableField(exist = false)
|
||||
private Integer feedSpeedUpper;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.mysql.configuration;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.configuration.ConfigurationDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.configuration.vo.*;
|
||||
|
||||
/**
|
||||
* 设备配置 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConfigurationMapper extends BaseMapperX<ConfigurationDO> {
|
||||
|
||||
default PageResult<ConfigurationDO> selectPage(ConfigurationPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ConfigurationDO>()
|
||||
.eqIfPresent(ConfigurationDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(ConfigurationDO::getSpeedOfMainshaftLower, reqVO.getSpeedOfMainshaftLower())
|
||||
.eqIfPresent(ConfigurationDO::getSpeedOfMainshaftUpper, reqVO.getSpeedOfMainshaftUpper())
|
||||
.eqIfPresent(ConfigurationDO::getFeedSpeedLower, reqVO.getFeedSpeedLower())
|
||||
.eqIfPresent(ConfigurationDO::getFeedSpeedUpper, reqVO.getFeedSpeedUpper())
|
||||
.orderByDesc(ConfigurationDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.mysql.dataacquisition;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.bgmasterline.BgMasterLineDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.configuration.ConfigurationDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.dataacquisition.DataAcquisitionDO;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition.vo.*;
|
||||
|
||||
/**
|
||||
* 设备数据采集 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataAcquisitionMapper extends BaseMapperX<DataAcquisitionDO> {
|
||||
|
||||
default PageResult<DataAcquisitionDO> selectPage(DataAcquisitionPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DataAcquisitionDO>()
|
||||
.eqIfPresent(DataAcquisitionDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(DataAcquisitionDO::getProgramNumber, reqVO.getProgramNumber())
|
||||
.eqIfPresent(DataAcquisitionDO::getToolNumber, reqVO.getToolNumber())
|
||||
.eqIfPresent(DataAcquisitionDO::getRunningDuration, reqVO.getRunningDuration())
|
||||
.eqIfPresent(DataAcquisitionDO::getRunningStatus, reqVO.getRunningStatus())
|
||||
.eqIfPresent(DataAcquisitionDO::getSpeedOfMainshaft, reqVO.getSpeedOfMainshaft())
|
||||
.eqIfPresent(DataAcquisitionDO::getFeedSpeed, reqVO.getFeedSpeed())
|
||||
.eqIfPresent(DataAcquisitionDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(DataAcquisitionDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DataAcquisitionDO::getId));
|
||||
}
|
||||
|
||||
@Select("SELECT * FROM equipment_data_acquisition WHERE (code, create_time) IN " +
|
||||
"(SELECT code, MAX(create_time) FROM equipment_data_acquisition WHERE status = 1 GROUP BY code) AND status = 1 ORDER BY running_status ASC;")
|
||||
List<DataAcquisitionDO> selectLatestByCode();
|
||||
|
||||
@Select("SELECT t1.id FROM equipment_data_acquisition t1 " +
|
||||
"INNER JOIN (" +
|
||||
" SELECT code, MAX(create_time) AS max_create_time " +
|
||||
" FROM equipment_data_acquisition " +
|
||||
" WHERE status = 1 " +
|
||||
" GROUP BY code" +
|
||||
") t2 ON t1.code = t2.code " +
|
||||
"WHERE t1.status = 0 " +
|
||||
" AND t1.create_time > t2.max_create_time " +
|
||||
"ORDER BY t1.create_time ASC")
|
||||
List<Long> selectNextStatusZeroIds();
|
||||
|
||||
default List<DataAcquisitionDO> getDataAcquisitionList(String code){
|
||||
MPJLambdaWrapper<DataAcquisitionDO> query = new MPJLambdaWrapper<>();
|
||||
query.selectAll(DataAcquisitionDO.class)
|
||||
.select("c.speed_of_mainshaft_lower as speedOfMainshaftLower","c.speed_of_mainshaft_upper as speedOfMainshaftUpper", "c.feed_speed_lower as feedSpeedLower","c.feed_speed_upper as feedSpeedUpper")
|
||||
.leftJoin(ConfigurationDO.class,"c",ConfigurationDO::getCode,DataAcquisitionDO::getCode)
|
||||
.disableSubLogicDel();
|
||||
query.eq(DataAcquisitionDO::getCode,code)
|
||||
.eq(DataAcquisitionDO::getStatus,1)
|
||||
.orderByDesc(DataAcquisitionDO::getCreateTime)
|
||||
.last("limit 10");
|
||||
return selectList(query);
|
||||
}
|
||||
}
|
||||
@ -252,4 +252,13 @@ public interface MaterialMapper extends BaseMapperX<MaterialDO> {
|
||||
;
|
||||
return selectPage(pageReqVO,query);
|
||||
}
|
||||
|
||||
default List<MaterialDO> selectName(String matName){
|
||||
|
||||
return selectList(new MPJLambdaWrapper<MaterialDO>()
|
||||
.select(MaterialDO::getName)
|
||||
.like(MaterialDO::getName, matName)
|
||||
.eq(MaterialDO::getStatus,1)
|
||||
.eq(MaterialDO::getTenantId, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.configuration;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.configuration.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.configuration.ConfigurationDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 设备配置 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ConfigurationService {
|
||||
|
||||
/**
|
||||
* 创建设备配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createConfiguration(@Valid ConfigurationSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateConfiguration(@Valid ConfigurationSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteConfiguration(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备配置
|
||||
*/
|
||||
ConfigurationDO getConfiguration(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备配置分页
|
||||
*/
|
||||
PageResult<ConfigurationDO> getConfigurationPage(ConfigurationPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.configuration;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.configuration.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.configuration.ConfigurationDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.chanko.yunxi.mes.module.heli.dal.mysql.configuration.ConfigurationMapper;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 设备配置 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ConfigurationServiceImpl implements ConfigurationService {
|
||||
|
||||
@Resource
|
||||
private ConfigurationMapper configurationMapper;
|
||||
|
||||
@Override
|
||||
public Long createConfiguration(ConfigurationSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ConfigurationDO configuration = BeanUtils.toBean(createReqVO, ConfigurationDO.class);
|
||||
configurationMapper.insert(configuration);
|
||||
// 返回
|
||||
return configuration.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfiguration(ConfigurationSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateConfigurationExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ConfigurationDO updateObj = BeanUtils.toBean(updateReqVO, ConfigurationDO.class);
|
||||
configurationMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfiguration(Long id) {
|
||||
// 校验存在
|
||||
validateConfigurationExists(id);
|
||||
// 删除
|
||||
configurationMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateConfigurationExists(Long id) {
|
||||
if (configurationMapper.selectById(id) == null) {
|
||||
// throw exception(CONFIGURATION_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationDO getConfiguration(Long id) {
|
||||
return configurationMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ConfigurationDO> getConfigurationPage(ConfigurationPageReqVO pageReqVO) {
|
||||
return configurationMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.dataacquisition;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.dataacquisition.DataAcquisitionDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 设备数据采集 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface DataAcquisitionService {
|
||||
|
||||
/**
|
||||
* 创建设备数据采集
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDataAcquisition(@Valid DataAcquisitionSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备数据采集
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDataAcquisition(@Valid DataAcquisitionSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备数据采集
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDataAcquisition(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备数据采集
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备数据采集
|
||||
*/
|
||||
DataAcquisitionDO getDataAcquisition(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备数据采集分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备数据采集分页
|
||||
*/
|
||||
PageResult<DataAcquisitionDO> getDataAcquisitionPage(DataAcquisitionPageReqVO pageReqVO);
|
||||
|
||||
void updateDataCollection();
|
||||
|
||||
List<DataAcquisitionDO> getList();
|
||||
|
||||
List<DataAcquisitionDO> getDataAcquisitionList(String code);
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.dataacquisition;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.dataacquisition.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.dataacquisition.DataAcquisitionDO;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.chanko.yunxi.mes.module.heli.dal.mysql.dataacquisition.DataAcquisitionMapper;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 设备数据采集 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DataAcquisitionServiceImpl implements DataAcquisitionService {
|
||||
|
||||
@Resource
|
||||
private DataAcquisitionMapper dataAcquisitionMapper;
|
||||
|
||||
@Override
|
||||
public Long createDataAcquisition(DataAcquisitionSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
DataAcquisitionDO dataAcquisition = BeanUtils.toBean(createReqVO, DataAcquisitionDO.class);
|
||||
dataAcquisitionMapper.insert(dataAcquisition);
|
||||
// 返回
|
||||
return dataAcquisition.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataAcquisition(DataAcquisitionSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDataAcquisitionExists(updateReqVO.getId());
|
||||
// 更新
|
||||
DataAcquisitionDO updateObj = BeanUtils.toBean(updateReqVO, DataAcquisitionDO.class);
|
||||
dataAcquisitionMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDataAcquisition(Long id) {
|
||||
// 校验存在
|
||||
validateDataAcquisitionExists(id);
|
||||
// 删除
|
||||
dataAcquisitionMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateDataAcquisitionExists(Long id) {
|
||||
if (dataAcquisitionMapper.selectById(id) == null) {
|
||||
// throw exception(DATA_ACQUISITION_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataAcquisitionDO getDataAcquisition(Long id) {
|
||||
return dataAcquisitionMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DataAcquisitionDO> getDataAcquisitionPage(DataAcquisitionPageReqVO pageReqVO) {
|
||||
return dataAcquisitionMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataCollection() {
|
||||
// 查找每个 code 分组中 status=1 的最大 createTime 之后的 status=0 的最小记录的 id
|
||||
List<Long> ids = dataAcquisitionMapper.selectNextStatusZeroIds();
|
||||
if (ObjectUtil.isNotEmpty(ids)){
|
||||
LambdaUpdateWrapper<DataAcquisitionDO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.in(DataAcquisitionDO::getId, ids);
|
||||
updateWrapper.set(DataAcquisitionDO::getStatus, 1);
|
||||
dataAcquisitionMapper.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataAcquisitionDO> getList() {
|
||||
return dataAcquisitionMapper.selectLatestByCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataAcquisitionDO> getDataAcquisitionList(String code) {
|
||||
return dataAcquisitionMapper.getDataAcquisitionList( code);
|
||||
}
|
||||
|
||||
}
|
||||
@ -79,4 +79,7 @@ public interface StorageLogService {
|
||||
PageResult<StorageLogNowDO> getSupplementPage(StorageLogPageReqVO pageReqVO);
|
||||
|
||||
|
||||
void getMatCode(List<StorageLogDO> list);
|
||||
|
||||
void submitForm(List<StorageLogDO> list);
|
||||
}
|
||||
|
||||
@ -107,6 +107,10 @@ public class StorageLogServiceImpl implements StorageLogService {
|
||||
public PageResult<StorageLogDO> getStorageLogPage(StorageLogPageReqVO pageReqVO) {
|
||||
// return storageLogAllMapper.selectPage(pageReqVO);
|
||||
PageResult<StorageLogDO> pageResult = storageLogMapper.selectPage(pageReqVO);
|
||||
Set<Long> idSet = Collections.unmodifiableSet(new HashSet<>());
|
||||
if (ObjectUtil.isNotEmpty(pageReqVO.getIds())){
|
||||
idSet = new HashSet<>(pageReqVO.getIds());
|
||||
}
|
||||
for (StorageLogDO logDO : pageResult.getList()) {
|
||||
if (logDO.getGoodsType()==2){
|
||||
if (ObjectUtil.isNotEmpty(logDO.getMatName())){
|
||||
@ -114,6 +118,9 @@ public class StorageLogServiceImpl implements StorageLogService {
|
||||
queryWrapper.eq(MaterialDO::getName, logDO.getMatName());
|
||||
List<MaterialDO> materialDOS = materialMapper.selectList(queryWrapper);
|
||||
logDO.setMaterialDOList(materialDOS);
|
||||
if (idSet.contains(logDO.getId()) && materialDOS.size() == 1) {
|
||||
logDO.setMatId(materialDOS.get(0).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -235,6 +242,20 @@ public class StorageLogServiceImpl implements StorageLogService {
|
||||
public PageResult<StorageLogNowDO> getSupplementPage(StorageLogPageReqVO pageReqVO) {
|
||||
return storageLogNowMapper.getSupplementPage(pageReqVO); }
|
||||
|
||||
@Override
|
||||
public void getMatCode(List<StorageLogDO> list) {
|
||||
for (StorageLogDO logDO : list) {
|
||||
List<MaterialDO> materialDOList = materialMapper.selectName(logDO.getMatName());
|
||||
if (ObjectUtil.isNotEmpty(materialDOList)&&materialDOList.size()==1){
|
||||
MaterialDO materialDO = materialDOList.get(0);
|
||||
logDO.setMatId(materialDO.getId());
|
||||
storageLogMapper.updateById(logDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void submitForm(List<StorageLogDO> list) {
|
||||
storageLogMapper.updateBatch(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chanko.yunxi.mes.module.heli.dal.mysql.dataacquisition.DataAcquisitionMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chanko.yunxi.mes.module.heli.dal.mysql.configuration.ConfigurationMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,49 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface DataAcquisitionVO {
|
||||
id: number
|
||||
code: string
|
||||
programNumber: string
|
||||
toolNumber: number
|
||||
runningDuration: string
|
||||
runningStatus: string
|
||||
speedOfMainshaft: string
|
||||
feedSpeed: string
|
||||
status: number
|
||||
}
|
||||
|
||||
// 查询设备数据采集分页
|
||||
export const getDataAcquisitionPage = async (params) => {
|
||||
return await request.get({ url: `/heli/data-acquisition/page`, params })
|
||||
}
|
||||
|
||||
// 查询设备数据采集详情
|
||||
export const getDataAcquisition = async (id: number) => {
|
||||
return await request.get({ url: `/heli/data-acquisition/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增设备数据采集
|
||||
export const createDataAcquisition = async (data: DataAcquisitionVO) => {
|
||||
return await request.post({ url: `/heli/data-acquisition/create`, data })
|
||||
}
|
||||
|
||||
// 修改设备数据采集
|
||||
export const updateDataAcquisition = async (data: DataAcquisitionVO) => {
|
||||
return await request.put({ url: `/heli/data-acquisition/update`, data })
|
||||
}
|
||||
|
||||
// 删除设备数据采集
|
||||
export const deleteDataAcquisition = async (id: number) => {
|
||||
return await request.delete({ url: `/heli/data-acquisition/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出设备数据采集 Excel
|
||||
export const exportDataAcquisition = async (params) => {
|
||||
return await request.download({ url: `/heli/data-acquisition/export-excel`, params })
|
||||
}
|
||||
export const getList = async () => {
|
||||
return await request.get({ url: `/heli/data-acquisition/getList` })
|
||||
}
|
||||
export const getDataAcquisitionList = async (code: string) => {
|
||||
return await request.get({ url: `/heli/data-acquisition/getDataAcquisitionList`, params: { code } })
|
||||
}
|
||||
@ -89,4 +89,6 @@ export const exportStorageLog = async (params) => {
|
||||
export const getSupplementPage = async (params) => {
|
||||
return await request.get({ url: `/heli/storage-log/getSupplementPage`, params })
|
||||
}
|
||||
|
||||
export const submitForm = async (data) => {
|
||||
return await request.post({ url: `/heli/storage-log/submitForm`, data })
|
||||
}
|
||||
|
||||
@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="设备编码" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入设备编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="程序号" prop="programNumber">
|
||||
<el-input v-model="formData.programNumber" placeholder="请输入程序号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="刀具号" prop="toolNumber">
|
||||
<el-input v-model="formData.toolNumber" placeholder="请输入刀具号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="运行时长" prop="runningDuration">
|
||||
<el-input v-model="formData.runningDuration" placeholder="请输入运行时长" />
|
||||
</el-form-item>
|
||||
<el-form-item label="运行状态" prop="runningStatus">
|
||||
<el-radio-group v-model="formData.runningStatus">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="主轴转速" prop="speedOfMainshaft">
|
||||
<el-input v-model="formData.speedOfMainshaft" placeholder="请输入主轴转速" />
|
||||
</el-form-item>
|
||||
<el-form-item label="进给速度" prop="feedSpeed">
|
||||
<el-input v-model="formData.feedSpeed" placeholder="请输入进给速度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="查询状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as DataAcquisitionApi from '@/api/heli/dataacquisition'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
programNumber: undefined,
|
||||
toolNumber: undefined,
|
||||
runningDuration: undefined,
|
||||
runningStatus: undefined,
|
||||
speedOfMainshaft: undefined,
|
||||
feedSpeed: undefined,
|
||||
status: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await DataAcquisitionApi.getDataAcquisition(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as DataAcquisitionApi.DataAcquisitionVO
|
||||
if (formType.value === 'create') {
|
||||
await DataAcquisitionApi.createDataAcquisition(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await DataAcquisitionApi.updateDataAcquisition(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
programNumber: undefined,
|
||||
toolNumber: undefined,
|
||||
runningDuration: undefined,
|
||||
runningStatus: undefined,
|
||||
speedOfMainshaft: undefined,
|
||||
feedSpeed: undefined,
|
||||
status: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<div class="JNPF-common-layout">
|
||||
<div class="JNPF-common-layout-center">
|
||||
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||
<div class="JNPF-common-head">
|
||||
<div>
|
||||
每秒自动刷新一次
|
||||
</div>
|
||||
</div>
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane
|
||||
v-for="device in deviceList"
|
||||
:key="device.code"
|
||||
:label="device.name"
|
||||
:name="device.code"
|
||||
>
|
||||
<el-table v-loading="loading" :data="dataList" border height="700px" :cell-class-name="cellClassName">
|
||||
<el-table-column prop="code" label="设备编号" align="center" />
|
||||
<el-table-column prop="speedOfMainshaft" label="主轴转速(S)" align="center" />
|
||||
<el-table-column prop="feedSpeed" label="进给速度(F)" align="center" />
|
||||
<el-table-column prop="runningDuration" label="设备运行时长" align="center" />
|
||||
<el-table-column prop="toolNumber" label="设备刀具号" align="center" />
|
||||
<el-table-column prop="programNumber" label="设备程序号" align="center" />
|
||||
<el-table-column prop="createTime" label="采集时间" align="center" :formatter="dateFormatter"/>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import request from '@/config/axios'
|
||||
import {dateFormatter} from "@/utils/formatTime";
|
||||
import * as DataAcquisitionApi from "@/api/heli/dataacquisition";
|
||||
|
||||
defineOptions({ name: 'DataAcquisition' })
|
||||
|
||||
|
||||
interface DeviceInfo {
|
||||
code: string
|
||||
name: string
|
||||
}
|
||||
|
||||
// 设备列表配置(10个设备)
|
||||
const deviceList: DeviceInfo[] = [
|
||||
{ code: '01#', name: '01#' },
|
||||
{ code: '02#', name: '02#' },
|
||||
{ code: '04#', name: '04#' },
|
||||
{ code: '07#', name: '07#' },
|
||||
{ code: '08#', name: '08#' },
|
||||
{ code: '09#', name: '09#' },
|
||||
{ code: '10#', name: '10#' },
|
||||
{ code: '11#', name: '11#' },
|
||||
{ code: '12#', name: '12#' },
|
||||
{ code: '13#', name: '13#' }
|
||||
]
|
||||
|
||||
const activeName = ref(deviceList[0].code)
|
||||
const timer = ref<NodeJS.Timeout | null>(null)
|
||||
const frequency = ref(1) // 默认1秒
|
||||
const dataList = ref([]) // 列表的数据
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
/** 监听 tab 切换 */
|
||||
watch(activeName, (newVal) => {
|
||||
clearTimer() // 清除旧定时器
|
||||
dataList.value = [] // 清空旧数据
|
||||
loading.value = true
|
||||
loadData(newVal).finally(() => {
|
||||
loading.value = false
|
||||
startTimer() // 重新启动定时器
|
||||
})
|
||||
})
|
||||
|
||||
/** 获取刷新频率 */
|
||||
const getFrequency = async () => {
|
||||
try {
|
||||
const res = await request.get({ url: '/system/dict-data/list-all-simple' })
|
||||
frequency.value = 60
|
||||
} catch (e) {
|
||||
frequency.value = 60
|
||||
}
|
||||
startTimer()
|
||||
}
|
||||
|
||||
/** 启动定时器 */
|
||||
const startTimer = () => {
|
||||
timer.value = setInterval(() => {
|
||||
loadData(activeName.value)
|
||||
}, frequency.value * 1000)
|
||||
}
|
||||
|
||||
/** 清除定时器 */
|
||||
const clearTimer = () => {
|
||||
if (timer.value) {
|
||||
clearInterval(timer.value)
|
||||
timer.value = null
|
||||
}
|
||||
}
|
||||
const cellClassName = ({ row,column }) => {
|
||||
if (column.label === '主轴转速(S)' && row.speedOfMainshaftLower&& row.speedOfMainshaftUpper) {
|
||||
return row.speedOfMainshaft < row.speedOfMainshaftLower || row.speedOfMainshaft > row.speedOfMainshaftUpper ? 'warning-row1' :"";
|
||||
}
|
||||
if (column.label === '进给速度(F)' && row.feedSpeedLower&&row.feedSpeedUpper) {
|
||||
return row.feedSpeed< row.feedSpeedLower || row.feedSpeed > row.feedSpeedUpper ? 'warning-row1' :"";
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
/** 加载数据 */
|
||||
const loadData = async (deviceCode: string) => {
|
||||
try {
|
||||
const data = await DataAcquisitionApi.getDataAcquisitionList(deviceCode)
|
||||
dataList.value=data
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
onMounted(async () => {
|
||||
await loadData(activeName.value)
|
||||
})
|
||||
onMounted(() => {
|
||||
startTimer()
|
||||
|
||||
|
||||
})
|
||||
onUnmounted(() => {
|
||||
clearTimer()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.JNPF-common-layout {
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
}
|
||||
.JNPF-common-layout-center {
|
||||
height: 100%;
|
||||
}
|
||||
.JNPF-common-layout-main {
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.JNPF-flex-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.JNPF-common-head {
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
:deep(.warning-row1) {
|
||||
background-color:#F08080 !important;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<div class="JNPF-common-layout">
|
||||
<div class="JNPF-common-layout-center">
|
||||
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||
<div class="JNPF-common-head">
|
||||
<div>
|
||||
每秒自动刷新一次
|
||||
</div>
|
||||
</div>
|
||||
<el-table v-loading="listLoading" :data="list" border height="900px">
|
||||
<el-table-column prop="code" label="设备编码" align="center" >
|
||||
<template #default="scope">
|
||||
<span :style="{ color: getStatusColor(scope.row.runningStatus) }">
|
||||
{{ scope.row.code }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前运行程序号" align="center" >
|
||||
<template #default="scope">
|
||||
<span :style="{ color: getStatusColor(scope.row.runningStatus) }" v-if="scope.row.runningStatus!=4">
|
||||
{{ scope.row.programNumber }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备刀具号" align="center" >
|
||||
<template #default="scope">
|
||||
<span :style="{ color: getStatusColor(scope.row.runningStatus) }" v-if="scope.row.runningStatus!=4">
|
||||
{{ scope.row.toolNumber }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="运行时长" align="center" >
|
||||
<template #default="scope">
|
||||
<span :style="{ color: getStatusColor(scope.row.runningStatus) }" v-if="scope.row.runningStatus!=4">
|
||||
{{ scope.row.runningDuration }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="runningStatus" label="运行状态" align="center">
|
||||
<template #default="scope">
|
||||
<span :style="{ color: getStatusColor(scope.row.runningStatus) }">
|
||||
{{ getStatusText(scope.row.runningStatus) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="采集时间" align="center" >
|
||||
<template #default="scope">
|
||||
<span :style="{ color: getStatusColor(scope.row.runningStatus) }" v-if="scope.row.runningStatus!=4" >
|
||||
{{ dateFormatter(scope.row,"createTime",scope.row.createTime) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import * as UserApi from "@/api/system/user";
|
||||
import * as DataAcquisitionApi from '@/api/heli/dataacquisition'
|
||||
import {dateFormatter} from "@/utils/formatTime";
|
||||
import {formatDate} from "@vueuse/core";
|
||||
|
||||
defineOptions({ name: 'DataAcquisition' })
|
||||
|
||||
interface DataItem {
|
||||
id: number
|
||||
code: string
|
||||
programNumber: string
|
||||
toolNumber: string
|
||||
runningDuration: string
|
||||
runningStatus: number
|
||||
speedOfMainshaft: string
|
||||
feedSpeed: string
|
||||
status: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
|
||||
const timer = ref<NodeJS.Timeout | null>(null)
|
||||
const list = ref<DataItem[]>([])
|
||||
const listLoading = ref(false)
|
||||
|
||||
/** 获取运行状态颜色 */
|
||||
const getStatusColor = (status: number): string => {
|
||||
const colorMap: Record<number, string> = {
|
||||
1: '#67C23A', // 运行 - 绿色
|
||||
2: '#E6A23C', // 待机 - 黄色
|
||||
3: '#F56C6C', // 报警 - 红色
|
||||
4: '#909399', // 离线 - 灰色
|
||||
}
|
||||
return colorMap[status] || '#909399'
|
||||
}
|
||||
|
||||
/** 获取运行状态文本 */
|
||||
const getStatusText = (status: number): string => {
|
||||
const textMap: Record<number, string> = {
|
||||
1: '运行',
|
||||
2: '待机',
|
||||
3: '报警',
|
||||
4: '离线',
|
||||
}
|
||||
return textMap[status] || '未知'
|
||||
}
|
||||
|
||||
/** 启动定时器 */
|
||||
const startTimer = () => {
|
||||
timer.value = setInterval(() => {
|
||||
getList()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
/** 清除定时器 */
|
||||
const clearTimer = () => {
|
||||
if (timer.value) {
|
||||
clearInterval(timer.value)
|
||||
timer.value = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 初始化数据 */
|
||||
const getList = async () => {
|
||||
// listLoading.value = true
|
||||
try {
|
||||
const data = await DataAcquisitionApi.getList()
|
||||
list.value = data
|
||||
} finally {
|
||||
// listLoading.value = false
|
||||
}
|
||||
}
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
})
|
||||
onMounted(() => {
|
||||
startTimer()
|
||||
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
clearTimer()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.JNPF-common-layout {
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
}
|
||||
.JNPF-common-layout-center {
|
||||
height: 100%;
|
||||
}
|
||||
.JNPF-common-layout-main {
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.JNPF-flex-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.JNPF-common-head {
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@ -114,9 +114,12 @@
|
||||
<el-table-column label="剩余金额(元)" align="center">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.cgYf !== null && scope.row.cgYifu !== null
|
||||
? Math.max(0, (Number(scope.row.cgYf) - (Number(scope.row.cgYifu) || 0))).toFixed(2)
|
||||
: Number(scope.row.cgYf) >= 0 ? Number(scope.row.cgYf).toFixed(2) : '0.00'
|
||||
(() => {
|
||||
const result = scope.row.cgYf !== null && scope.row.cgYifu !== null
|
||||
? Math.max(0, (Number(scope.row.cgYf) - (Number(scope.row.cgYifu) || 0)))
|
||||
: Number(scope.row.cgYf) >= 0 ? Number(scope.row.cgYf) : 0
|
||||
return result === 0 ? '' : result.toFixed(2)
|
||||
})()
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -134,11 +137,12 @@
|
||||
<el-table-column label="剩余开票金额(元)" align="center" min-width="90">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.cgYf && scope.row.amount
|
||||
? Math.max(0, (Number(scope.row.cgYf) - Number(scope.row.amount))).toFixed(2)
|
||||
: scope.row.cgYf
|
||||
? Math.max(0, Number(scope.row.cgYf)).toFixed(2)
|
||||
: '0.00'
|
||||
(() => {
|
||||
const result = scope.row.cgYf && scope.row.amount
|
||||
? Math.max(0, (Number(scope.row.cgYf) - Number(scope.row.amount)))
|
||||
: scope.row.cgYf ? Math.max(0, Number(scope.row.cgYf)) : 0
|
||||
return result === 0 ? '' : result.toFixed(2)
|
||||
})()
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -131,9 +131,12 @@
|
||||
<el-table-column label="剩余金额(元)" align="center" width="160px">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.cgYs !== null && scope.row.cgYishou !== null
|
||||
? Math.max(0, (Number(scope.row.cgYs) - (Number(scope.row.cgYishou) || 0))).toFixed(2)
|
||||
: Number(scope.row.cgYs) >= 0 ? Number(scope.row.cgYs).toFixed(2) : '0.00'
|
||||
(() => {
|
||||
const result = scope.row.cgYs !== null && scope.row.cgYishou !== null
|
||||
? Math.max(0, (Number(scope.row.cgYs) - (Number(scope.row.cgYishou) || 0)))
|
||||
: Number(scope.row.cgYs) >= 0 ? Number(scope.row.cgYs) : 0
|
||||
return result === 0 ? '' : result.toFixed(2)
|
||||
})()
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -151,11 +154,12 @@
|
||||
<el-table-column label="剩余开票金额(元)" align="center" width="170px">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.cgYs && scope.row.amount
|
||||
? Math.max(0, (Number(scope.row.cgYs) - Number(scope.row.amount))).toFixed(2)
|
||||
: scope.row.cgYs
|
||||
? Math.max(0, Number(scope.row.cgYs)).toFixed(2)
|
||||
: '0.00'
|
||||
(() => {
|
||||
const result = scope.row.cgYs && scope.row.amount
|
||||
? Math.max(0, (Number(scope.row.cgYs) - Number(scope.row.amount)))
|
||||
: scope.row.cgYs ? Math.max(0, Number(scope.row.cgYs)) : 0
|
||||
return result === 0 ? '' : result.toFixed(2)
|
||||
})()
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
<el-button @click="resetQuery">
|
||||
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
||||
</el-button>
|
||||
<el-button style="margin-left: 18px" @click="getMatCode()" type="primary" size="large">获取物料编码</el-button>
|
||||
<el-button style="margin-left: 18px" @click="submitForm()" type="success" size="large">保存</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -51,9 +53,22 @@
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" class="hl-table">
|
||||
<el-table-column type="index" width="100" fixed label="序号" align="center" />
|
||||
<el-table-column label="物料编码" align="center" prop="matCode" min-width="150" fixed>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" class="hl-table" ref="multipleTable" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="70" />
|
||||
<el-table-column type="index" width="100" label="序号" align="center" />
|
||||
<el-table-column label="单据类型" align="center" prop="stockMode" min-width="180" >
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.HELI_STORAGE_TYPE" :value="scope.row.stockType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据状态" align="center" prop="stockMode" min-width="180" >
|
||||
<template #default="scope">
|
||||
{{scope.row.isExport==0?'未生成':'已生成'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据编号" align="center" prop="stockNo" min-width="120" />
|
||||
|
||||
<el-table-column label="物料编码" align="center" prop="matCode" min-width="250" >
|
||||
<template #default="scope">
|
||||
<template v-if="scope.row.goodsType == 2">
|
||||
<el-form-item class="mb-0px!">
|
||||
@ -78,7 +93,7 @@
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称" align="center" prop="matName" min-width="120" fixed />
|
||||
<el-table-column label="物料名称" align="center" prop="matName" min-width="120" />
|
||||
<el-table-column label="规格/型号" align="center" prop="matSpec" min-width="120" />
|
||||
<el-table-column label="单据编号" align="center" prop="codeNo" min-width="180" />
|
||||
<el-table-column label="业务单据类型" align="center" prop="stockMode" min-width="180" >
|
||||
@ -115,15 +130,14 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
import * as WarehouseApi from '@/api/heli/warehouse'
|
||||
import routeParamsCache from '@/utils/routeParamsCache'
|
||||
import axios from "axios";
|
||||
import {getAccessToken, getTenantId} from "@/utils/auth";
|
||||
import Material from "@/views/heli/material/index.vue";
|
||||
import MaterialSelect from "@/views/heli/hlvuestyle/materialSelect.vue";
|
||||
import {ElButton, ElTableColumn} from "element-plus";
|
||||
import {ref} from "vue";
|
||||
|
||||
|
||||
defineOptions({ name: 'StorageLog' })
|
||||
|
||||
const whList = ref([])
|
||||
|
||||
const multipleSelection = ref([])
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
@ -144,9 +158,13 @@ const queryParams = reactive({
|
||||
headerNo: undefined,
|
||||
codeNo:undefined,
|
||||
matSpec:undefined,
|
||||
ids:[],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
const handleSelectionChange = (val) => {
|
||||
// 更新 multipleSelection
|
||||
multipleSelection.value = val;
|
||||
};
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
@ -182,6 +200,60 @@ const init_page_wh = (async ()=>{
|
||||
// const init_page_pn = (async ()=>{
|
||||
// pnList.value = await PnApi.getSimpList()
|
||||
// })
|
||||
const getMatCode = async () => {
|
||||
try {
|
||||
|
||||
const list = multipleSelection.value || []; // 安全获取数据
|
||||
// 1. 检查空数据
|
||||
if (!list || list.length==null) {
|
||||
message.error("提交明细不能为空,请确认");
|
||||
return;
|
||||
}
|
||||
queryParams.ids=list.map(item=>item.id)
|
||||
getList();
|
||||
queryParams.ids=[]
|
||||
message.success("获取成功");
|
||||
emit('success');
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error("获取失败:", error);
|
||||
// message.error(`操作失败: ${error.message || "未知错误"}`);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const submitForm = async () => {
|
||||
try {
|
||||
|
||||
const list = multipleSelection.value || []; // 安全获取数据
|
||||
// 1. 检查空数据
|
||||
if (!list || list.length==null) {
|
||||
message.error("提交明细不能为空,请确认");
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
// 5. 提交数据(添加超时处理)
|
||||
const res = await Promise.race([
|
||||
StorageLogApi.submitForm(list),
|
||||
new Promise((_, reject) =>
|
||||
setTimeout(() => reject(new Error("请求超时")), 30000)
|
||||
)
|
||||
]);
|
||||
message.success("保存成功");
|
||||
getList(); // 确保刷新完成
|
||||
emit('success');
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error("获取失败:", error);
|
||||
// message.error(`操作失败: ${error.message || "未知错误"}`);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 初始化 **/
|
||||
const route = useRoute()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user