Compare commits

...

5 Commits

84 changed files with 5368 additions and 290 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,89 @@
package com.mt.wms.basic.controller;
import com.mt.wms.basic.params.AlarmBaseParam;
import com.mt.wms.basic.params.AlarmBaseQueryParam;
import com.mt.wms.basic.params.CraftInfoParam;
import com.mt.wms.basic.params.CraftInfoQueryParam;
import com.mt.wms.basic.service.AlarmBaseService;
import com.mt.wms.basic.service.CraftInfoService;
import com.mt.wms.basic.vo.AlarmBaseVo;
import com.mt.wms.basic.vo.CraftInfoVo;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.utils.IDGenerator;
import com.mt.wms.core.validator.groups.AddGroup;
import com.mt.wms.core.validator.groups.PageGroup;
import com.mt.wms.core.validator.groups.UpdateGroup;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.groups.Default;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/10/9 11:09
* @Version 1.0
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "craftInfo")
@Slf4j
@Api(value = "工艺基础信息管理", tags = "工艺基础信息管理", hidden = false)
public class CraftInfoController extends BaseController {
@Autowired
private CraftInfoService craftInfoService;
@PostMapping(value = "get")
@ApiOperation(value = "获取报警基础信息")
private R<CraftInfoVo> get(@Validated @RequestBody IdParam idParam) {
return craftInfoService.get(idParam);
}
@PostMapping(value = "list")
@ApiOperation(value = "获取报警基础信息列表")
private R<List<CraftInfoVo>> list(@Validated({Default.class}) @RequestBody CraftInfoQueryParam craftInfoQueryParam) {
return craftInfoService.list(craftInfoQueryParam);
}
@PostMapping(value = "page")
@ApiOperation(value = "获取分页报警基础信息")
private R<PageVo<CraftInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody CraftInfoQueryParam craftInfoQueryParam) {
return craftInfoService.page(craftInfoQueryParam);
}
@PostMapping(value = "add")
@ApiOperation(value = "新增")
private R<IdVo> add(@Validated({AddGroup.class, Default.class}) @RequestBody CraftInfoParam craftInfoParam) {
return craftInfoService.add(craftInfoParam);
}
@PostMapping(value = "update")
@ApiOperation(value = "更新")
private R<IdVo> update(@Validated({UpdateGroup.class, Default.class}) @RequestBody CraftInfoParam craftInfoParam) {
return craftInfoService.update(craftInfoParam);
}
@PostMapping(value = "delete")
@ApiOperation(value = "删除报警基础信息")
private R<IdVo> delete(@Validated @RequestBody IdParam idParam) {
return craftInfoService.delete(idParam);
}
@PostMapping(value = "codeGenerator")
@ApiOperation(value = "编码生成")
private R<String> codeGenerator() {
return successful(IDGenerator.gen("GY", "yyyyMMddHHmm", 2, "CRAFTINFO_CODE"));
}
}

View File

@ -0,0 +1,53 @@
package com.mt.wms.basic.params;
import com.mt.wms.core.base.BaseParam;
import com.mt.wms.core.validator.groups.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* @Author: liguanghao
* @Date: 2022/1/25 21:34
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "工艺基础信息参数对象", description = "用于新增和更新工艺基础信息")
public class CraftInfoParam extends BaseParam {
private static final long serialVersionUID = 1L;
/**
* 主键自增
*/
@ApiModelProperty(value = "主键",required = false, example = "1")
@NotNull(message = "xxID不能为空", groups = {UpdateGroup.class})
private Long id;
/**
* 编码
*/
@ApiModelProperty(value = "编码", example = "1")
private String code;
/**
* 工艺号
*/
@ApiModelProperty(value = "工艺号", example = "1")
@NotNull(message = "工艺号不能为空")
private String craftCode;
/**
* plc值
*/
@ApiModelProperty(value = "plc值", example = "1")
@NotNull(message = "plc值不能为空")
private Integer plcValue;
/**
* 说明
*/
@ApiModelProperty(value = "说明", example = "1")
private String content;
}

View File

@ -0,0 +1,31 @@
package com.mt.wms.basic.params;
import com.mt.wms.core.params.BasePageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: liguanghao
* @Date: 2022/1/25 21:37
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "报警基础信息查询参数", description = "用于查询报警基础信息")
public class CraftInfoQueryParam extends BasePageParam {
/**
* 主键自增
*/
@ApiModelProperty(value = "主键",required = false, example = "1")
private Long id;
/**
* 工艺号
*/
@ApiModelProperty(value = "工艺号",required = false, example = "1")
private String craftCode;
}

View File

@ -49,6 +49,12 @@ public class KilnInfoParam extends BaseParam {
@ApiModelProperty(value = "缩写(别名)", example = "1")
@NotNull(message = "别名不能为空")
private String kilnAlias;
/**
* 设备类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉
*/
@ApiModelProperty(value = "设备类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉", example = "1")
@NotNull(message = "设备类型不能为空")
private Integer type;
/**

View File

@ -0,0 +1,73 @@
package com.mt.wms.basic.service;
import com.mt.wms.basic.params.AlarmBaseParam;
import com.mt.wms.basic.params.AlarmBaseQueryParam;
import com.mt.wms.basic.params.CraftInfoParam;
import com.mt.wms.basic.params.CraftInfoQueryParam;
import com.mt.wms.basic.vo.AlarmBaseVo;
import com.mt.wms.basic.vo.CraftInfoVo;
import com.mt.wms.core.dal.entity.CraftInfo;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/10/9 10:46
* @Version 1.0
*/
public interface CraftInfoService {
/**
* 获取xx
*
* @param idParam 主键参数
* @return xx
*/
R<CraftInfoVo> get(IdParam idParam);
/**
* 获取xx列表
*
* @param craftInfoQueryParam xx查询参数
* @return xx列表
*/
R<List<CraftInfoVo>> list(CraftInfoQueryParam craftInfoQueryParam);
/**
* 获取xx分页列表
*
* @param craftInfoQueryParam xx查询参数
* @return xx分页列表
*/
R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam);
/**
* 新增xx
*
* @param craftInfoParam xx参数
* @return 主键
*/
R<IdVo> add(CraftInfoParam craftInfoParam);
/**
* 更新xx
*
* @param craftInfoParam xx参数
* @return 主键
*/
R<IdVo> update(CraftInfoParam craftInfoParam);
/**
* 删除xx
*
* @param idParam 主键参数
* @return 主键
*/
R<IdVo> delete(IdParam idParam);
}

View File

@ -0,0 +1,97 @@
package com.mt.wms.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.wms.basic.params.AlarmBaseParam;
import com.mt.wms.basic.params.AlarmBaseQueryParam;
import com.mt.wms.basic.params.CraftInfoParam;
import com.mt.wms.basic.params.CraftInfoQueryParam;
import com.mt.wms.basic.service.AlarmBaseService;
import com.mt.wms.basic.service.CraftInfoService;
import com.mt.wms.basic.vo.AlarmBaseVo;
import com.mt.wms.basic.vo.CraftInfoVo;
import com.mt.wms.core.api.Assert;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.AlarmBase;
import com.mt.wms.core.dal.entity.CraftInfo;
import com.mt.wms.core.dal.service.AlarmBaseServiceBiz;
import com.mt.wms.core.dal.service.CraftInfoServiceBiz;
import com.mt.wms.core.errorcode.ApiErrorCode;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/10/9 10:49
* @Version 1.0
*/
@Service
@Transactional
public class CraftInfoServiceImpl extends BaseService implements CraftInfoService {
@Resource
private CraftInfoServiceBiz craftInfoServiceBiz;
@Override
public R<CraftInfoVo> get(IdParam idParam) {
Assert.notNull(ApiErrorCode.INVALID_PARAMETER,idParam.getId());
CraftInfo craftInfo = craftInfoServiceBiz.getById(idParam.getId());
CraftInfoVo craftInfoVo = CraftInfoVo.builder().build();
BeanUtils.copyProperties(craftInfo,craftInfoVo);
return successful(craftInfoVo);
}
@Override
public R<List<CraftInfoVo>> list(CraftInfoQueryParam craftInfoQueryParam) {
QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
wrapper.eq(CraftInfo.VALID,1);
List<CraftInfo> craftInfoList = craftInfoServiceBiz.list(wrapper);
List<CraftInfoVo> craftInfoVoList = com.mt.wms.core.utils.BeanUtils.copyList(craftInfoList, CraftInfoVo.class);
return successful(craftInfoVoList);
}
@Override
public R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam) {
QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(craftInfoQueryParam.getCraftCode()),CraftInfo.CRAFT_CODE,craftInfoQueryParam.getCraftCode())
.orderByDesc(CraftInfo.CREATE_TIME);
Page<CraftInfo> page = craftInfoServiceBiz.page(new Page<>(craftInfoQueryParam.getCurrent(), craftInfoQueryParam.getSize()), wrapper);
return successful(new PageVo<>(page,CraftInfoVo.class));
}
@Override
public R<IdVo> add(CraftInfoParam craftInfoParam) {
QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
CraftInfo craftInfo=new CraftInfo();
BeanUtils.copyProperties(craftInfoParam,craftInfo);
setCommonField(craftInfo);
craftInfoServiceBiz.save(craftInfo);
return successful(IdVo.builder().id(craftInfo.getId()).build());
}
@Override
public R<IdVo> update(CraftInfoParam craftInfoParam) {
CraftInfo craftInfo = craftInfoServiceBiz.getById(craftInfoParam.getId());
CraftInfo updateCraftInfo=new CraftInfo();
BeanUtils.copyProperties(craftInfoParam,updateCraftInfo);
setUpdateCommonField(updateCraftInfo);
craftInfoServiceBiz.updateById(updateCraftInfo);
return successful(IdVo.builder().id(updateCraftInfo.getId()).build());
}
@Override
public R<IdVo> delete(IdParam idParam) {
craftInfoServiceBiz.removeById(idParam.getId());
return successful(IdVo.builder().id(idParam.getId()).build());
}
}

View File

@ -0,0 +1,55 @@
package com.mt.wms.basic.vo;
import com.mt.wms.core.base.BaseVo;
import com.mt.wms.core.vo.PageVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: liguanghao
* @Date: 2022/1/25 21:27
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "工艺信息视图对象", description = "用于查询工艺信息信息")
public class CraftInfoVo extends BaseVo implements PageVo.ConvertVo{
/**
* 主键自增
*/
@ApiModelProperty(value = "主键,更新时需要填写", example = "1")
private Long id;
/**
* 编码
*/
@ApiModelProperty(value = "编码", example = "1")
private String code;
/**
* 工艺号
*/
@ApiModelProperty(value = "工艺号", example = "1")
private String craftCode;
/**
* plc值
*/
@ApiModelProperty(value = "plc值", example = "1")
private Integer plcValue;
/**
* 状态
*/
@ApiModelProperty(value = "状态", example = "1")
private Integer status;
/**
* 说明
*/
@ApiModelProperty(value = "说明", example = "1")
private String content;
}

View File

@ -32,6 +32,12 @@ public class KilnInfoVo extends BaseVo implements PageVo.ConvertVo {
@ApiModelProperty(value = "编码", example = "1")
private String code;
/**
* 类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉
*/
@ApiModelProperty(value = "类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉", example = "1")
private Integer type;
/**
* 名称
*/

View File

@ -106,7 +106,7 @@ public class MyGenerator {
@Test
public void generateCodeWithInjectConfigForAllTable() {
generateByTablesWithInjectConfig(new String[]{"t_apms_check_result"});
generateByTablesWithInjectConfig(new String[]{"t_auto_exe_task"});
}
public static void main(String[] args) {

View File

@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -92,7 +92,7 @@ public class AlarmInfo extends Model<AlarmInfo> {
* 设备id
*/
@TableField("equipment_id")
private Integer equipmentId;
private Long equipmentId;
/**
* 设备名称
@ -130,6 +130,12 @@ public class AlarmInfo extends Model<AlarmInfo> {
@TableField("note")
private String note;
/**
* 加工任务编码炉子报警时记录
*/
@TableField("task_code")
private String taskCode;
public static final String ID = "id";
@ -165,6 +171,8 @@ public class AlarmInfo extends Model<AlarmInfo> {
public static final String NOTE = "note";
public static final String TASK_CODE = "task_code";
@Override
protected Serializable pkVal() {
return this.id;

View File

@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2021-12-14
* @since 2022-03-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -46,7 +46,7 @@ public class AutoExeTask extends Model<AutoExeTask> {
private LocalDateTime createTime;
/**
* 状态0新增1执行中2完成
* 状态0新增1执行中2完成3 终止
*/
@TableField("status")
private Integer status;
@ -117,6 +117,12 @@ public class AutoExeTask extends Model<AutoExeTask> {
@TableField("f_equipment_id")
private Long fEquipmentId;
/**
* 设备名称炉子名称
*/
@TableField("f_equipment_name")
private String fEquipmentName;
/**
* 工艺号ID关联工艺号表t_craft_info
*/
@ -165,6 +171,12 @@ public class AutoExeTask extends Model<AutoExeTask> {
@TableField("t_equipment_type_id")
private Long tEquipmentTypeId;
/**
* 设备名称
*/
@TableField("t_equipment_name")
private String tEquipmentName;
/**
* 设备ID关联设备表t_kiln_info
*/
@ -219,6 +231,12 @@ public class AutoExeTask extends Model<AutoExeTask> {
@TableField("th_equipment_type_id")
private Long thEquipmentTypeId;
/**
* 设备名称
*/
@TableField("th_equipment_name")
private String thEquipmentName;
/**
* 设备ID关联设备表t_kiln_info
*/
@ -292,6 +310,8 @@ public class AutoExeTask extends Model<AutoExeTask> {
public static final String F_EQUIPMENT_ID = "f_equipment_id";
public static final String F_EQUIPMENT_NAME = "f_equipment_name";
public static final String F_CRAFT_CODE_ID = "f_craft_code_id";
public static final String F_PLC_VALUE = "f_plc_value";
@ -308,6 +328,8 @@ public class AutoExeTask extends Model<AutoExeTask> {
public static final String T_EQUIPMENT_TYPE_ID = "t_equipment_type_id";
public static final String T_EQUIPMENT_NAME = "t_equipment_name";
public static final String T_EQUIPMENT_ID = "t_equipment_id";
public static final String T_CRAFT_CODE_ID = "t_craft_code_id";
@ -326,6 +348,8 @@ public class AutoExeTask extends Model<AutoExeTask> {
public static final String TH_EQUIPMENT_TYPE_ID = "th_equipment_type_id";
public static final String TH_EQUIPMENT_NAME = "th_equipment_name";
public static final String TH_EQUIPMENT_ID = "th_equipment_id";
public static final String TH_CRAFT_CODE_ID = "th_craft_code_id";

View File

@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -71,7 +71,7 @@ public class KilnInfo extends Model<KilnInfo> {
private String version;
/**
* 状态 0初始化1损坏
* 状态 0初始化1损坏 2 工作中
*/
@TableField("status")
private Integer status;
@ -83,7 +83,7 @@ public class KilnInfo extends Model<KilnInfo> {
private String interCode;
/**
* 编码
* 编码 必须与AMPS相同
*/
@TableField("code")
private String code;
@ -95,7 +95,7 @@ public class KilnInfo extends Model<KilnInfo> {
private Integer factoryId;
/**
* 窑炉名称
* 窑炉名称 建议与AMPS相同
*/
@TableField("kiln_name")
private String kilnName;
@ -113,10 +113,10 @@ public class KilnInfo extends Model<KilnInfo> {
private String en;
/**
* 设备类型存储数据字典编码
* 设备类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉
*/
@TableField("type")
private String type;
private Integer type;
/**
* ip地址

View File

@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -53,7 +53,13 @@ public class ParEleValue extends Model<ParEleValue> {
* 窑炉id关联设备窑炉表t_kiln_info
*/
@TableField("kiln_id")
private Integer kilnId;
private Long kilnId;
/**
* 任务id
*/
@TableField("task_id")
private Long taskId;
/**
* 参数id关联参数表t_par_info
@ -104,10 +110,10 @@ public class ParEleValue extends Model<ParEleValue> {
private Float totalBat;
/**
* 扩展字段1
* 时间段类型0半小时12:
*/
@TableField("add_a")
private Float addA;
@TableField("date_type")
private Integer dateType;
/**
* 扩展字段2
@ -150,6 +156,8 @@ public class ParEleValue extends Model<ParEleValue> {
public static final String KILN_ID = "kiln_id";
public static final String TASK_ID = "task_id";
public static final String PAR_ID = "par_id";
public static final String A_VOLTAGEV_VALUE = "a_voltagev_value";
@ -166,7 +174,7 @@ public class ParEleValue extends Model<ParEleValue> {
public static final String TOTAL_BAT = "total_bat";
public static final String ADD_A = "add_a";
public static final String DATE_TYPE = "date_type";
public static final String ADD_B = "add_b";

View File

@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -53,7 +53,13 @@ public class ParGasValue extends Model<ParGasValue> {
* 窑炉id关联设备窑炉表t_kiln_info
*/
@TableField("kiln_id")
private Integer kilnId;
private Long kilnId;
/**
* 任务id
*/
@TableField("task_id")
private Long taskId;
/**
* 参数id关联参数表t_par_info
@ -62,13 +68,13 @@ public class ParGasValue extends Model<ParGasValue> {
private Integer parId;
/**
* 设定氮势值
* 设定氮/势值
*/
@TableField("set_nit_pot_value")
private Float setNitPotValue;
/**
* 实际氮势值
* 实际氮/势值
*/
@TableField("actual_nit_pot_value")
private Float actualNitPotValue;
@ -80,46 +86,46 @@ public class ParGasValue extends Model<ParGasValue> {
private Float acceptNitPotValue;
/**
* 氮气
* 氮气
*/
@TableField("nit_flow_value")
private Float nitFlowValue;
/**
* 氨气
* 氨气
*/
@TableField("ammonia_flow_value")
private Float ammoniaFlowValue;
/**
* 二氧化碳
* 二氧化碳
*/
@TableField("car_dioxide_flow_value")
private Float carDioxideFlowValue;
/**
* 扩展字段1
* 甲烷量
*/
@TableField("add_a")
private Float addA;
@TableField("methanol_flow")
private Float methanolFlow;
/**
* 扩展字段2
* 丙烷量
*/
@TableField("add_b")
private Float addB;
@TableField("propane_flow")
private Float propaneFlow;
/**
* 扩展字段3
* 氢含量
*/
@TableField("add_c")
private Float addC;
@TableField("hydrogen_content")
private Float hydrogenContent;
/**
* 扩展字段4
* 分解率
*/
@TableField("orther_a")
private String ortherA;
@TableField("decomposition_rate")
private Float decompositionRate;
/**
* 扩展字段5
@ -144,6 +150,8 @@ public class ParGasValue extends Model<ParGasValue> {
public static final String KILN_ID = "kiln_id";
public static final String TASK_ID = "task_id";
public static final String PAR_ID = "par_id";
public static final String SET_NIT_POT_VALUE = "set_nit_pot_value";
@ -158,13 +166,13 @@ public class ParGasValue extends Model<ParGasValue> {
public static final String CAR_DIOXIDE_FLOW_VALUE = "car_dioxide_flow_value";
public static final String ADD_A = "add_a";
public static final String METHANOL_FLOW = "methanol_flow";
public static final String ADD_B = "add_b";
public static final String PROPANE_FLOW = "propane_flow";
public static final String ADD_C = "add_c";
public static final String HYDROGEN_CONTENT = "hydrogen_content";
public static final String ORTHER_A = "orther_a";
public static final String DECOMPOSITION_RATE = "decomposition_rate";
public static final String ORTHER_B = "orther_b";

View File

@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -53,7 +53,13 @@ public class ParRotSpeedValue extends Model<ParRotSpeedValue> {
* 窑炉id关联设备窑炉表t_kiln_info
*/
@TableField("kiln_id")
private Integer kilnId;
private Long kilnId;
/**
* 任务id
*/
@TableField("task_id")
private Long taskId;
/**
* 参数id关联参数表t_par_info
@ -156,6 +162,8 @@ public class ParRotSpeedValue extends Model<ParRotSpeedValue> {
public static final String KILN_ID = "kiln_id";
public static final String TASK_ID = "task_id";
public static final String PAR_ID = "par_id";
public static final String FAN_SPEED_A_VALUE = "fan_speed_a_value";

View File

@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -53,7 +53,13 @@ public class ParTemValue extends Model<ParTemValue> {
* 窑炉id关联设备窑炉表t_kiln_info
*/
@TableField("kiln_id")
private Integer kilnId;
private Long kilnId;
/**
* 任务id
*/
@TableField("task_id")
private Long taskId;
/**
* 参数id关联参数表t_par_info
@ -98,22 +104,22 @@ public class ParTemValue extends Model<ParTemValue> {
private Float takeOverOilSetTemValue;
/**
* 扩展字段1
* 外一区温度
*/
@TableField("add_a")
private Float addA;
@TableField("outer_zone1_temp")
private Float outerZone1Temp;
/**
* 扩展字段2
* 外二区温度
*/
@TableField("add_b")
private Float addB;
@TableField("outer_zone2_temp")
private Float outerZone2Temp;
/**
* 扩展字段3
* 炉压
*/
@TableField("add_c")
private Float addC;
@TableField("furnace_pressure")
private Float furnacePressure;
/**
* 扩展字段4
@ -144,6 +150,8 @@ public class ParTemValue extends Model<ParTemValue> {
public static final String KILN_ID = "kiln_id";
public static final String TASK_ID = "task_id";
public static final String PAR_ID = "par_id";
public static final String SET_TEM_VALUE = "set_tem_value";
@ -158,11 +166,11 @@ public class ParTemValue extends Model<ParTemValue> {
public static final String TAKE_OVER_OIL_SET_TEM_VALUE = "take_over_oil_set_tem_value";
public static final String ADD_A = "add_a";
public static final String OUTER_ZONE1_TEMP = "outer_zone1_temp";
public static final String ADD_B = "add_b";
public static final String OUTER_ZONE2_TEMP = "outer_zone2_temp";
public static final String ADD_C = "add_c";
public static final String FURNACE_PRESSURE = "furnace_pressure";
public static final String ORTHER_A = "orther_a";

View File

@ -0,0 +1,98 @@
package com.mt.wms.core.dal.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* PLC变量nameSpace对照表
* </p>
*
* @author mt
* @since 2022-02-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_plc_name_space")
public class PlcNameSpace extends Model<PlcNameSpace> {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableField("id")
private Long id;
/**
* 设备类型1多用加工炉2氮化炉3回火炉4清洗机5:rgv
*/
@TableField("eq_type")
private Integer eqType;
/**
* 变量名称
*/
@TableField("name")
private String name;
/**
* 变量的含义
*/
@TableField("note")
private String note;
/**
* 设备id
*/
@TableField("eq_id")
private Long eqId;
/**
* 设备名称
*/
@TableField("eq_name")
private String eqName;
/**
* 变量类型0变量1报警变量
*/
@TableField("type")
private Integer type;
/**
* 备注
*/
@TableField("remark")
private String remark;
public static final String ID = "id";
public static final String EQ_TYPE = "eq_type";
public static final String NAME = "name";
public static final String NOTE = "note";
public static final String EQ_ID = "eq_id";
public static final String EQ_NAME = "eq_name";
public static final String TYPE = "type";
public static final String REMARK = "remark";
@Override
protected Serializable pkVal() {
return null;
}
}

View File

@ -0,0 +1,91 @@
package com.mt.wms.core.dal.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 点位信息表
* </p>
*
* @author mt
* @since 2022-03-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_point_info")
public class PointInfo extends Model<PointInfo> {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableField("id")
private Integer id;
/**
* 点位编码对应plc
*/
@TableField("code")
private Long code;
/**
* 点位对应的设备名称
*/
@TableField("name")
private String name;
/**
* 点位说明关联对应表数据的code窑炉code,库位code等等
*/
@TableField("note")
private String note;
/**
* 类型1 炉子2 液压台3 库位
*/
@TableField("type")
private Integer type;
/**
* 距离原点的距离
*/
@TableField("distance")
private Double distance;
/**
* 创建时间
*/
@TableField("create_time")
private LocalDate createTime;
public static final String ID = "id";
public static final String CODE = "code";
public static final String NAME = "name";
public static final String NOTE = "note";
public static final String TYPE = "type";
public static final String DISTANCE = "distance";
public static final String CREATE_TIME = "create_time";
@Override
protected Serializable pkVal() {
return null;
}
}

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
public interface AlarmInfoMapper extends BaseMapper<AlarmInfo> {

View File

@ -21,11 +21,12 @@
<result column="alarm_info" property="alarmInfo" />
<result column="description" property="description" />
<result column="note" property="note" />
<result column="task_code" property="taskCode" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, equipment_id, equipment_name, type, alarm_code, alarm_info, description, note
id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, equipment_id, equipment_name, type, alarm_code, alarm_info, description, note, task_code
</sql>
</mapper>

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2021-12-14
* @since 2022-03-04
*/
public interface AutoExeTaskMapper extends BaseMapper<AutoExeTask> {

View File

@ -19,6 +19,7 @@
<result column="f_det_task_code" property="fDetTaskCode" />
<result column="f_equipment_type_id" property="fEquipmentTypeId" />
<result column="f_equipment_id" property="fEquipmentId" />
<result column="f_equipment_name" property="fEquipmentName" />
<result column="f_craft_code_id" property="fCraftCodeId" />
<result column="f_plc_value" property="fPlcValue" />
<result column="f_in_tran_status" property="fInTranStatus" />
@ -27,6 +28,7 @@
<result column="t_task_id" property="tTaskId" />
<result column="t_det_task_code" property="tDetTaskCode" />
<result column="t_equipment_type_id" property="tEquipmentTypeId" />
<result column="t_equipment_name" property="tEquipmentName" />
<result column="t_equipment_id" property="tEquipmentId" />
<result column="t_craft_code_id" property="tCraftCodeId" />
<result column="t_plc_value" property="tPlcValue" />
@ -36,6 +38,7 @@
<result column="th_task_id" property="thTaskId" />
<result column="th_det_task_code" property="thDetTaskCode" />
<result column="th_equipment_type_id" property="thEquipmentTypeId" />
<result column="th_equipment_name" property="thEquipmentName" />
<result column="th_equipment_id" property="thEquipmentId" />
<result column="th_craft_code_id" property="thCraftCodeId" />
<result column="th_plc_value" property="thPlcValue" />
@ -47,7 +50,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, valid, create_time, status, inter_code, process_flow_id, process_flow_name, process_flow_type, craft_code_id, craft_code, warehouse_id, f_task_id, f_det_task_code, f_equipment_type_id, f_equipment_id, f_craft_code_id, f_plc_value, f_in_tran_status, f_pro_status, f_out_tran_status, t_task_id, t_det_task_code, t_equipment_type_id, t_equipment_id, t_craft_code_id, t_plc_value, t_in_tran_status, t_pro_status, t_out_tran_status, th_task_id, th_det_task_code, th_equipment_type_id, th_equipment_id, th_craft_code_id, th_plc_value, th_in_tran_status, th_pro_status, th_out_tran_status, content
id, valid, create_time, status, inter_code, process_flow_id, process_flow_name, process_flow_type, craft_code_id, craft_code, warehouse_id, f_task_id, f_det_task_code, f_equipment_type_id, f_equipment_id, f_equipment_name, f_craft_code_id, f_plc_value, f_in_tran_status, f_pro_status, f_out_tran_status, t_task_id, t_det_task_code, t_equipment_type_id, t_equipment_name, t_equipment_id, t_craft_code_id, t_plc_value, t_in_tran_status, t_pro_status, t_out_tran_status, th_task_id, th_det_task_code, th_equipment_type_id, th_equipment_name, th_equipment_id, th_craft_code_id, th_plc_value, th_in_tran_status, th_pro_status, th_out_tran_status, content
</sql>
</mapper>

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
public interface KilnInfoMapper extends BaseMapper<KilnInfo> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParEleValueMapper extends BaseMapper<ParEleValue> {

View File

@ -9,6 +9,7 @@
<result column="inter_code" property="interCode" />
<result column="status" property="status" />
<result column="kiln_id" property="kilnId" />
<result column="task_id" property="taskId" />
<result column="par_id" property="parId" />
<result column="a_voltagev_value" property="aVoltagevValue" />
<result column="b_voltagev_value" property="bVoltagevValue" />
@ -17,7 +18,7 @@
<result column="b_current_value" property="bCurrentValue" />
<result column="c_current_value" property="cCurrentValue" />
<result column="total_bat" property="totalBat" />
<result column="add_a" property="addA" />
<result column="date_type" property="dateType" />
<result column="add_b" property="addB" />
<result column="add_c" property="addC" />
<result column="orther_a" property="ortherA" />
@ -27,7 +28,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, create_time, inter_code, status, kiln_id, par_id, a_voltagev_value, b_voltagev_value, c_voltagev_value, a_current_value, b_current_value, c_current_value, total_bat, add_a, add_b, add_c, orther_a, orther_b, orther_c
id, create_time, inter_code, status, kiln_id, task_id, par_id, a_voltagev_value, b_voltagev_value, c_voltagev_value, a_current_value, b_current_value, c_current_value, total_bat, date_type, add_b, add_c, orther_a, orther_b, orther_c
</sql>
</mapper>

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParGasValueMapper extends BaseMapper<ParGasValue> {

View File

@ -9,6 +9,7 @@
<result column="inter_code" property="interCode" />
<result column="status" property="status" />
<result column="kiln_id" property="kilnId" />
<result column="task_id" property="taskId" />
<result column="par_id" property="parId" />
<result column="set_nit_pot_value" property="setNitPotValue" />
<result column="actual_nit_pot_value" property="actualNitPotValue" />
@ -16,17 +17,17 @@
<result column="nit_flow_value" property="nitFlowValue" />
<result column="ammonia_flow_value" property="ammoniaFlowValue" />
<result column="car_dioxide_flow_value" property="carDioxideFlowValue" />
<result column="add_a" property="addA" />
<result column="add_b" property="addB" />
<result column="add_c" property="addC" />
<result column="orther_a" property="ortherA" />
<result column="methanol_flow" property="methanolFlow" />
<result column="propane_flow" property="propaneFlow" />
<result column="hydrogen_content" property="hydrogenContent" />
<result column="decomposition_rate" property="decompositionRate" />
<result column="orther_b" property="ortherB" />
<result column="orther_c" property="ortherC" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, create_time, inter_code, status, kiln_id, par_id, set_nit_pot_value, actual_nit_pot_value, accept_nit_pot_value, nit_flow_value, ammonia_flow_value, car_dioxide_flow_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
id, create_time, inter_code, status, kiln_id, task_id, par_id, set_nit_pot_value, actual_nit_pot_value, accept_nit_pot_value, nit_flow_value, ammonia_flow_value, car_dioxide_flow_value, methanol_flow, propane_flow, hydrogen_content, decomposition_rate, orther_b, orther_c
</sql>
</mapper>

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParRotSpeedValueMapper extends BaseMapper<ParRotSpeedValue> {

View File

@ -9,6 +9,7 @@
<result column="inter_code" property="interCode" />
<result column="status" property="status" />
<result column="kiln_id" property="kilnId" />
<result column="task_id" property="taskId" />
<result column="par_id" property="parId" />
<result column="fan_speed_a_value" property="fanSpeedAValue" />
<result column="fan_speed_b_value" property="fanSpeedBValue" />
@ -28,7 +29,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, create_time, inter_code, status, kiln_id, par_id, fan_speed_a_value, fan_speed_b_value, oil_sti_speed_a_value, oil_sti_speed_b_value, oil_sti_speed_c_value, oil_sti_speed_d_value, oil_sti_speed_e_value, oil_sti_speed_f_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
id, create_time, inter_code, status, kiln_id, task_id, par_id, fan_speed_a_value, fan_speed_b_value, oil_sti_speed_a_value, oil_sti_speed_b_value, oil_sti_speed_c_value, oil_sti_speed_d_value, oil_sti_speed_e_value, oil_sti_speed_f_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
</sql>
</mapper>

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParTemValueMapper extends BaseMapper<ParTemValue> {

View File

@ -9,6 +9,7 @@
<result column="inter_code" property="interCode" />
<result column="status" property="status" />
<result column="kiln_id" property="kilnId" />
<result column="task_id" property="taskId" />
<result column="par_id" property="parId" />
<result column="set_tem_value" property="setTemValue" />
<result column="act_tem_value" property="actTemValue" />
@ -16,9 +17,9 @@
<result column="oil_tank_set_tem_value" property="oilTankSetTemValue" />
<result column="take_over_set_tem_value" property="takeOverSetTemValue" />
<result column="take_over_oil_set_tem_value" property="takeOverOilSetTemValue" />
<result column="add_a" property="addA" />
<result column="add_b" property="addB" />
<result column="add_c" property="addC" />
<result column="outer_zone1_temp" property="outerZone1Temp" />
<result column="outer_zone2_temp" property="outerZone2Temp" />
<result column="furnace_pressure" property="furnacePressure" />
<result column="orther_a" property="ortherA" />
<result column="orther_b" property="ortherB" />
<result column="orther_c" property="ortherC" />
@ -26,7 +27,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, create_time, inter_code, status, kiln_id, par_id, set_tem_value, act_tem_value, oil_tank_act_tem_value, oil_tank_set_tem_value, take_over_set_tem_value, take_over_oil_set_tem_value, add_a, add_b, add_c, orther_a, orther_b, orther_c
id, create_time, inter_code, status, kiln_id, task_id, par_id, set_tem_value, act_tem_value, oil_tank_act_tem_value, oil_tank_set_tem_value, take_over_set_tem_value, take_over_oil_set_tem_value, outer_zone1_temp, outer_zone2_temp, furnace_pressure, orther_a, orther_b, orther_c
</sql>
</mapper>

View File

@ -0,0 +1,16 @@
package com.mt.wms.core.dal.mapper;
import com.mt.wms.core.dal.entity.PlcNameSpace;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* PLC变量nameSpace对照表 Mapper 接口
* </p>
*
* @author mt
* @since 2022-02-28
*/
public interface PlcNameSpaceMapper extends BaseMapper<PlcNameSpace> {
}

View File

@ -0,0 +1,22 @@
<?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.mt.wms.core.dal.mapper.PlcNameSpaceMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.mt.wms.core.dal.entity.PlcNameSpace">
<result column="id" property="id" />
<result column="eq_type" property="eqType" />
<result column="name" property="name" />
<result column="note" property="note" />
<result column="eq_id" property="eqId" />
<result column="eq_name" property="eqName" />
<result column="type" property="type" />
<result column="remark" property="remark" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, eq_type, name, note, eq_id, eq_name, type, remark
</sql>
</mapper>

View File

@ -0,0 +1,16 @@
package com.mt.wms.core.dal.mapper;
import com.mt.wms.core.dal.entity.PointInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 点位信息表 Mapper 接口
* </p>
*
* @author mt
* @since 2022-03-02
*/
public interface PointInfoMapper extends BaseMapper<PointInfo> {
}

View File

@ -0,0 +1,21 @@
<?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.mt.wms.core.dal.mapper.PointInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.mt.wms.core.dal.entity.PointInfo">
<result column="id" property="id" />
<result column="code" property="code" />
<result column="name" property="name" />
<result column="note" property="note" />
<result column="type" property="type" />
<result column="distance" property="distance" />
<result column="create_time" property="createTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, code, name, note, type, distance, create_time
</sql>
</mapper>

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
public interface AlarmInfoServiceBiz extends IService<AlarmInfo> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2021-12-14
* @since 2022-03-04
*/
public interface AutoExeTaskServiceBiz extends IService<AutoExeTask> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
public interface KilnInfoServiceBiz extends IService<KilnInfo> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParEleValueServiceBiz extends IService<ParEleValue> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParGasValueServiceBiz extends IService<ParGasValue> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParRotSpeedValueServiceBiz extends IService<ParRotSpeedValue> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
public interface ParTemValueServiceBiz extends IService<ParTemValue> {

View File

@ -0,0 +1,16 @@
package com.mt.wms.core.dal.service;
import com.mt.wms.core.dal.entity.PlcNameSpace;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* PLC变量nameSpace对照表 服务类
* </p>
*
* @author mt
* @since 2022-02-28
*/
public interface PlcNameSpaceServiceBiz extends IService<PlcNameSpace> {
}

View File

@ -0,0 +1,16 @@
package com.mt.wms.core.dal.service;
import com.mt.wms.core.dal.entity.PointInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 点位信息表 服务类
* </p>
*
* @author mt
* @since 2022-03-02
*/
public interface PointInfoServiceBiz extends IService<PointInfo> {
}

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
@Service
public class AlarmInfoServiceBizImpl extends ServiceImpl<AlarmInfoMapper, AlarmInfo> implements AlarmInfoServiceBiz {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-12-14
* @since 2022-03-04
*/
@Service
public class AutoExeTaskServiceBizImpl extends ServiceImpl<AutoExeTaskMapper, AutoExeTask> implements AutoExeTaskServiceBiz {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-02-28
*/
@Service
public class KilnInfoServiceBizImpl extends ServiceImpl<KilnInfoMapper, KilnInfo> implements KilnInfoServiceBiz {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Service
public class ParEleValueServiceBizImpl extends ServiceImpl<ParEleValueMapper, ParEleValue> implements ParEleValueServiceBiz {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Service
public class ParGasValueServiceBizImpl extends ServiceImpl<ParGasValueMapper, ParGasValue> implements ParGasValueServiceBiz {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Service
public class ParRotSpeedValueServiceBizImpl extends ServiceImpl<ParRotSpeedValueMapper, ParRotSpeedValue> implements ParRotSpeedValueServiceBiz {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2021-11-18
* @since 2022-03-01
*/
@Service
public class ParTemValueServiceBizImpl extends ServiceImpl<ParTemValueMapper, ParTemValue> implements ParTemValueServiceBiz {

View File

@ -0,0 +1,20 @@
package com.mt.wms.core.dal.service.impl;
import com.mt.wms.core.dal.entity.PlcNameSpace;
import com.mt.wms.core.dal.mapper.PlcNameSpaceMapper;
import com.mt.wms.core.dal.service.PlcNameSpaceServiceBiz;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* PLC变量nameSpace对照表 服务实现类
* </p>
*
* @author mt
* @since 2022-02-28
*/
@Service
public class PlcNameSpaceServiceBizImpl extends ServiceImpl<PlcNameSpaceMapper, PlcNameSpace> implements PlcNameSpaceServiceBiz {
}

View File

@ -0,0 +1,20 @@
package com.mt.wms.core.dal.service.impl;
import com.mt.wms.core.dal.entity.PointInfo;
import com.mt.wms.core.dal.mapper.PointInfoMapper;
import com.mt.wms.core.dal.service.PointInfoServiceBiz;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 点位信息表 服务实现类
* </p>
*
* @author mt
* @since 2022-03-02
*/
@Service
public class PointInfoServiceBizImpl extends ServiceImpl<PointInfoMapper, PointInfo> implements PointInfoServiceBiz {
}

View File

@ -27,7 +27,23 @@ public class CodeGeneratorHelper {
*/
public static final String ORDER_CODE = "ORDER_CODE";
/**
* 报警编码
*/
public static final String ALARM_CODE = "ALARM_CODE";
/**
* 自动任务编码
*/
public static final String AUTO_TASK_CODE = "AUTO_TASK_CODE";
/**
* 生成自动任务编码
*
* @return 订单编号
*/
public static String getAutoTaskCode() {
return IDGenerator.gen("ZD", "yyyyMMdd", 6, AUTO_TASK_CODE);
}
/**
* 生成订单编号
*
@ -36,5 +52,13 @@ public class CodeGeneratorHelper {
public static String getOrderCode() {
return IDGenerator.gen("20", "yyyyMMdd", 6, ORDER_CODE);
}
/**
* 生成报警编码
*
* @return 报警编码
*/
public static String getAlarmCode() {
return IDGenerator.gen("BJ", "yyyyMMdd", 6, ALARM_CODE);
}
}

View File

@ -27,6 +27,7 @@ import java.io.IOException;
import java.nio.charset.Charset;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.concurrent.TimeUnit;
/**
* 使用 OKhttp 请求 Api 数据
@ -46,7 +47,11 @@ public class HttpClient {
}
public static String httpPost(String url, String json) throws IOException {
OkHttpClient httpClient = new OkHttpClient();
//OkHttpClient httpClient = new OkHttpClient();
OkHttpClient httpClient = new OkHttpClient().newBuilder().connectTimeout(300L, TimeUnit.SECONDS)
.writeTimeout(300, TimeUnit.SECONDS)
.readTimeout(300, TimeUnit.SECONDS)
.build();
RequestBody requestBody = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url(url)

View File

@ -0,0 +1,56 @@
package com.mt.wms.empty.controller;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.validator.groups.PageGroup;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.AutoTaskQueryParam;
import com.mt.wms.empty.service.AutoTaskService;
import com.mt.wms.empty.vo.AutoTaskVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.groups.Default;
/**
* @Author: liguanghao
* @Date: 2022/3/3 23:35
* @Version 1.0
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "autoTask")
@Slf4j
@Api(value = "自动任务相关接口", tags = "自动任务相关接口", hidden = false)
public class AutoTaskController extends BaseController {
@Autowired
private AutoTaskService autoTaskService;
@PostMapping(value = "get")
@ApiOperation(value = "获取自动任务基础信息")
private R<AutoTaskVo> get(@Validated @RequestBody IdParam idParam) {
return autoTaskService.get(idParam);
}
@PostMapping(value = "page")
@ApiOperation(value = "获取分页自动任务基础信息")
private R<PageVo<AutoTaskVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody AutoTaskQueryParam autoTaskQueryParam) {
return autoTaskService.page(autoTaskQueryParam);
}
@PostMapping(value = "stop")
@ApiOperation(value = "终止自动任务")
private R<IdVo> stop(@Validated @RequestBody IdParam idParam){
return autoTaskService.stop(idParam);
}
}

View File

@ -1,19 +1,23 @@
package com.mt.wms.empty.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mt.wms.basic.service.KilnInfoService;
import com.mt.wms.basic.vo.KilnInfoVo;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.dal.entity.AutoExeTask;
import com.mt.wms.core.dal.entity.CurrTask;
import com.mt.wms.core.dal.service.AutoExeTaskServiceBiz;
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
import com.mt.wms.core.params.BasePageParam;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.utils.CodeGeneratorHelper;
import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.ApmsCreateProcessSheet;
import com.mt.wms.empty.params.CreateItem;
import com.mt.wms.empty.params.CurrTaskQueryParam;
import com.mt.wms.empty.params.TaskCreateParam;
import com.mt.wms.empty.params.*;
import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.empty.service.CurrTaskService;
import com.mt.wms.empty.service.OrderInfoService;
@ -24,6 +28,8 @@ import com.mt.wms.empty.vo.CurrTaskQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
@ -31,10 +37,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Map;
import java.util.*;
/**
* @author xcc
@ -56,6 +62,11 @@ public class CurrTaskController extends BaseController {
private ApmsController apmsControl;
@Autowired
private KilnInfoService kilnInfoService;
@Autowired
private CurrTaskServiceBiz currTaskServiceBiz;
@Autowired
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@PostMapping(value = "createProcessTask")
@ApiOperation(value = "订单加工-创建一个加工任务至任务队列")
@ -124,6 +135,114 @@ public class CurrTaskController extends BaseController {
}
}
@PostMapping(value = "createAutoTask")
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
//自动任务循环添加多条currTask
AutoExeTask autoExeTask=new AutoExeTask();
for (TaskCreateParam param:detParams
) {
//验证标识卡号正确无误
orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams());
//验证炉子编码信息在apms正确无误
R<KilnInfoVo> kilnInfoVoR = kilnInfoService.get(IdParam.builder().id(param.getKilnId()).build());
String kilnCode = kilnInfoVoR.getData().getCode();
R<ApmsStoveVo> bm = apmsControl.getStoveCodeByWorkShopCode("BM");
ArrayList<Map<String, String>> stoveCodes = bm.getData().getStoveCodes();
//验证apms数据中存在这个炉子
boolean verifyCodes = false;
ArrayList<String> codeStr = new ArrayList<>();
stoveCodes.forEach(kilnMap -> {
codeStr.add(kilnMap.get("code"));
});
for (String s : codeStr)
{
if (s.equals(kilnCode))
{
verifyCodes = true;
break;
}
}
if (!verifyCodes)
{
return failed("创建失败APMS中验证炉号" + kilnCode + "失败!");
}
//通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
apmsCreateSheet.setWorkShopCode("BM");
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsCreateSheet.setTechCode(param.getCraftCode());
//fixme 暂时没有正式user使用测试账户
apmsCreateSheet.setStartUser("QJJP03");
ArrayList<CreateItem> createItems = new ArrayList<>();
param.getDetParams().forEach(e -> {
CreateItem createItem = new CreateItem();
createItem.setItemCode(e.getIdenCardNum());
createItem.setQuantity(e.getQuantity().intValue());
createItem.setWeight(e.getWeight().doubleValue());
createItems.add(createItem);
});
apmsCreateSheet.setStoveCode(kilnCode);
apmsCreateSheet.setItems(createItems);
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
if (processSheet.getData().getSuccess())
{
//apms创建成功后写入数据库
R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
CurrTask currTask = currTaskServiceBiz.getById(mainTask.getData().getId());
//工艺步骤中第一步
if (param.getAutoTaskStep()==1){
autoExeTask.setInterCode(CodeGeneratorHelper.getAutoTaskCode());
autoExeTask.setProcessFlowType(param.getAutoTaskType());
autoExeTask.setFTaskId(currTask.getId());
autoExeTask.setFDetTaskCode(currTask.getTaskCode());
autoExeTask.setFEquipmentId(currTask.getKilnId());
autoExeTask.setFEquipmentName(currTask.getKilnName());
autoExeTask.setFCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setFPlcValue(currTask.getPlcValue());
setCommonField(autoExeTask);
autoExeTaskServiceBiz.save(autoExeTask);
}
if (param.getAutoTaskStep()==2){
autoExeTask.setTTaskId(currTask.getId());
autoExeTask.setTDetTaskCode(currTask.getTaskCode());
autoExeTask.setTEquipmentId(currTask.getKilnId());
autoExeTask.setTEquipmentName(currTask.getKilnName());
autoExeTask.setTCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setTPlcValue(currTask.getPlcValue());
setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask);
}
if (param.getAutoTaskStep()==3){
autoExeTask.setThTaskId(currTask.getId());
autoExeTask.setThDetTaskCode(currTask.getTaskCode());
autoExeTask.setThEquipmentId(currTask.getKilnId());
autoExeTask.setThEquipmentName(currTask.getKilnName());
autoExeTask.setThCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setThPlcValue(currTask.getPlcValue());
setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask);
}
String sheetNo = processSheet.getData().getSheetNo();
//将返回的生产单号写入到主任务中
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
currTaskById.setSheetNo(sheetNo);
currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
return successful("创建成功,任务添加至等待执行队列。");
}
else
{
return failed("创建失败APMS报错" + processSheet.getData().getMsg());
}
}
return null;
}
@PostMapping(value = "mainCurrentTaskNow")
@ApiOperation(value = "首页-获取当前执行中的任务")
@ -148,4 +267,10 @@ public class CurrTaskController extends BaseController {
public R<String> deleteBySheetNo(@Validated @RequestBody String sheetNo) {
return currTaskService.deleteBySheetNo(sheetNo);
}
@PostMapping(value = "runTask")
@ApiOperation(value = "执行任务")
public R<String> runTask(@Validated @RequestBody Long taskId) {
//点击执行按钮会判断当前任务是否为自动任务如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成仅非一步时
return currTaskService.runTask(taskId);
}
}

View File

@ -1,99 +0,0 @@
package com.mt.wms.empty.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.JsonObject;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.dal.entity.ParEleValue;
import com.mt.wms.core.dal.service.ParEleValueServiceBiz;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.ElectricQueryParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.groups.Default;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2021/12/16 11:20
* @Version 1.0
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "electric")
@Slf4j
@Api(value = "电能消耗相关接口", tags = "电能消耗相关接口", hidden = false)
public class ElectricController extends BaseController {
@Autowired
private ParEleValueServiceBiz parEleValueServiceBiz;
@PostMapping(value = "eletric")
@ApiOperation(value = "根据窑炉id获取电能消耗情况")
private R<String> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
Long kiln = electricQueryParam.getKilnId();
//窑炉id为0代表全部
if (kiln==0){
}else {
JSONObject jsonObject=new JSONObject();
//指定时间节点
LocalDate timeDate = electricQueryParam.getTime().toLocalDate();
LocalDateTime timeStart = LocalDateTime.of(timeDate, LocalTime.MIN);
LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX);
//当前时间节点
LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
LocalDateTime todayEnd = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
//总电能消耗
List<ParEleValue> todayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", todayStart, todayEnd)
.orderByDesc("create_time"));
Float countEleValue = todayEleValueList.get(0).getTotalBat();
jsonObject.put("countEle",countEleValue);
//昨日电能消耗
LocalDateTime yesterdayStart = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MIN);
LocalDateTime yesterdayEnd = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MAX);
List<ParEleValue> yesterdayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", yesterdayStart, yesterdayEnd)
.orderByAsc("create_time"));
Float yesterdayTotalBat= yesterdayEleValueList.get(yesterdayEleValueList.size()-1).getTotalBat()-yesterdayEleValueList.get(0).getTotalBat();
jsonObject.put("yesterdayCountEle",yesterdayTotalBat);
//指定日期当天的电能消耗
if (electricQueryParam.getDateType()==1){
List<ParEleValue> dateEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", timeStart, timeEnd)
.orderByAsc("create_time"));
//总耗电量
Float dateCountEle=0F;
if (dateEleValueList.size()!=0){
dateCountEle= dateEleValueList.get(dateEleValueList.size()-1).getTotalBat()-dateEleValueList.get(0).getTotalBat();
}
jsonObject.put("dateCountEle",dateCountEle);
//分时消耗量
for (int i = 0; i < dateEleValueList.size() - 1; ++i) {
// TODO: 2021/12/16
float eleValue = dateEleValueList.get(i).getTotalBat() - dateEleValueList.get(i - 1).getTotalBat();
}
}
}
return null;
}
}

View File

@ -0,0 +1,459 @@
package com.mt.wms.empty.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.JsonObject;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.ElectricQueryParam;
import com.mt.wms.empty.vo.ConsumeDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.validation.groups.Default;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
* @Author: liguanghao
* @Date: 2021/12/16 11:20
* @Version 1.0
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "electric")
@Slf4j
@Api(value = "电能消耗相关接口", tags = "电能消耗相关接口", hidden = false)
public class EnergyController extends BaseController {
//@PostConstruct
public void test(){
LocalDateTime time=LocalDateTime.of(2021, 3, 31, 0, 0, 0);
Float f=29000F;
LocalDate timeDate=time.toLocalDate();
LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX).minus(5,ChronoUnit.SECONDS);
for (int i = 0; i < 10; i++) {
ParEleValue parEleValue=new ParEleValue();
parEleValue.setDateType(2);
parEleValue.setParId(1);
parEleValue.setKilnId(1L);
parEleValue.setTotalBat(Float.valueOf(String.valueOf(f+(Math.random()*24000))));
parEleValue.setCreateTime(timeEnd);
timeEnd=timeEnd.plus(1,ChronoUnit.MONTHS);
f=parEleValue.getTotalBat();
parEleValueServiceBiz.save(parEleValue);
System.out.println(parEleValue);
}
}
@Autowired
private ParEleValueServiceBiz parEleValueServiceBiz;
@Autowired
private ParGasValueServiceBiz parGasValueServiceBiz;
@Autowired
private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
@Autowired
private ParTemValueServiceBiz parTemValueServiceBiz;
@Autowired
private KilnInfoServiceBiz kilnInfoServiceBiz;
@PostMapping(value = "eletric")
@ApiOperation(value = "根据窑炉id获取消耗情况")
public R<String> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
Long kiln = electricQueryParam.getKilnId();
//窑炉id为0代表全部存储的时候计算全部
JSONObject jsonObject=new JSONObject();
//指定时间节点
LocalDate timeDate = electricQueryParam.getTime().toLocalDate();
LocalDateTime timeStart = LocalDateTime.of(timeDate, LocalTime.MIN);
LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX);
//当前时间节点
LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
LocalDateTime todayEnd = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
//总电能消耗
List<ParEleValue> todayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", todayStart, todayEnd)
.orderByDesc("create_time"));
Float countEleValue = todayEleValueList.get(0).getTotalBat();
jsonObject.put("countEle",countEleValue);
//昨日电能消耗
LocalDateTime yesterdayStart = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MIN);
LocalDateTime yesterdayEnd = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MAX);
List<ParEleValue> yesterdayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", yesterdayStart, yesterdayEnd)
.eq("date_type",0)
.orderByAsc("create_time"));
Float yesterdayTotalBat= yesterdayEleValueList.get(yesterdayEleValueList.size()-1).getTotalBat()-yesterdayEleValueList.get(0).getTotalBat();
jsonObject.put("yesterdayCountEle",yesterdayTotalBat);
//指定日期当天的电能消耗
if (electricQueryParam.getDateType()==0){
List<ParEleValue> dateEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", timeStart, timeEnd)
.orderByAsc("create_time"));
//总耗电量
Float dateCountEle=0F;
if (dateEleValueList.size()!=0){
dateCountEle= dateEleValueList.get(dateEleValueList.size()-1).getTotalBat()-dateEleValueList.get(0).getTotalBat();
}
jsonObject.put("dateCountEle",dateCountEle);
//分时消耗量
Map<String,Float> timeJsonObject=new LinkedHashMap();
for (int i = 0; i < dateEleValueList.size() - 1; ++i) {
// TODO: 2021/12/16
float eleValue = dateEleValueList.get(i).getTotalBat() - dateEleValueList.get(i - 1).getTotalBat();
int j=i+1;
if (j%2==0){
String time=(j-1)/2+":30";
timeJsonObject.put(time,eleValue);
}else {
String time=(j-1)/2+":00";
timeJsonObject.put(time,eleValue);
}
}
jsonObject.put("timeEle",timeJsonObject);
}
//指定日期当周的每天电能消耗
if(electricQueryParam.getDateType()==1){
LocalDate monday = timeDate.with(DayOfWeek.MONDAY);
LocalDate sunday = timeDate.with(DayOfWeek.SUNDAY);
List<ParEleValue> timeWeekEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", monday, sunday.plusDays(1))
.eq("date_type", 1)
.orderByAsc("create_time"));
//总耗电量
Float dateCountEle=0F;
if (timeWeekEleValueList.size()!=0){
dateCountEle= timeWeekEleValueList.get(timeWeekEleValueList.size()-1).getTotalBat()-timeWeekEleValueList.get(0).getTotalBat();
}
jsonObject.put("dateCountEle",dateCountEle);
Map<String,Float> timeJsonObject=new LinkedHashMap();
for (ParEleValue parEleValue:timeWeekEleValueList
) {
LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
}
jsonObject.put("timeEle",timeJsonObject);
}
//指定日期当月的每天电能消耗
if(electricQueryParam.getDateType()==2){
LocalDate firstday = LocalDate.of(timeDate.getYear(), timeDate.getMonthValue(), 1);
LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfMonth());
List<ParEleValue> timeMonthEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", firstday, lastDay.plusDays(1))
.eq("date_type", 1)
.orderByAsc("create_time"));
//总耗电量
Float dateCountEle=0F;
if (timeMonthEleValueList.size()!=0){
dateCountEle= timeMonthEleValueList.get(timeMonthEleValueList.size()-1).getTotalBat()-timeMonthEleValueList.get(0).getTotalBat();
}
jsonObject.put("dateCountEle",dateCountEle);
Map<String,Float> timeJsonObject=new LinkedHashMap();
for (ParEleValue parEleValue:timeMonthEleValueList
) {
LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
}
jsonObject.put("timeEle",timeJsonObject);
}
//指定日期当年的每月电能消耗
if(electricQueryParam.getDateType()==2){
LocalDate firstDay = timeDate.with(TemporalAdjusters.firstDayOfYear());
LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfYear());
List<ParEleValue> timeYearEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq("kiln_id", kiln)
.between("create_time", firstDay, lastDay.plusDays(1))
.eq("date_type", 2)
.orderByAsc("create_time"));
//总耗电量
Float dateCountEle=0F;
if (timeYearEleValueList.size()!=0){
dateCountEle= timeYearEleValueList.get(timeYearEleValueList.size()-1).getTotalBat()-timeYearEleValueList.get(0).getTotalBat();
}
jsonObject.put("dateCountEle",dateCountEle);
Map<String,Float> timeJsonObject=new LinkedHashMap();
for (ParEleValue parEleValue:timeYearEleValueList
) {
LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
}
jsonObject.put("timeEle",timeJsonObject);
}
return successful(jsonObject.toJSONString());
}
@PostMapping(value = "energyList")
@ApiOperation(value = "根据加工炉id获取能源消耗情况")
public R<String> energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam){
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(electricQueryParam.getKilnId());
Integer kilnType = kilnInfo.getType();
//传入任务号窑炉号查询消耗数据返回json字符串
JSONObject jsonObject=new JSONObject();
ConsumeDataVo consumeDataVo=ConsumeDataVo.builder().build();
//电能消耗
List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
if (parEleValueList.size()>0){
List eleList=new ArrayList();
//电能消耗
List<ConsumeDataVo> eleConsume=new ArrayList<>();
//A向电压
List<ConsumeDataVo> aVolConsume=new ArrayList<>();
//B向电压
List<ConsumeDataVo> bVolConsume=new ArrayList<>();
//C向电压
List<ConsumeDataVo> cVolConsume=new ArrayList<>();
for (ParEleValue parEleValue:parEleValueList
) {
consumeDataVo.setCreateTime(parEleValue.getCreateTime());
consumeDataVo.setValue(parEleValue.getTotalBat());
consumeDataVo.setName("耗电量");
consumeDataVo.setUnit("KW");
eleConsume.add(consumeDataVo);
consumeDataVo.setValue(parEleValue.getAVoltagevValue());
consumeDataVo.setName("A向电压");
consumeDataVo.setUnit("V");
aVolConsume.add(consumeDataVo);
consumeDataVo.setValue(parEleValue.getBVoltagevValue());
consumeDataVo.setName("B向电压");
consumeDataVo.setUnit("V");
bVolConsume.add(consumeDataVo);
consumeDataVo.setValue(parEleValue.getCVoltagevValue());
consumeDataVo.setName("C向电压");
consumeDataVo.setUnit("V");
cVolConsume.add(consumeDataVo);
}
eleList.add(eleConsume);
eleList.add(aVolConsume);
eleList.add(bVolConsume);
eleList.add(cVolConsume);
jsonObject.put("ele",eleList);
}
//氮气甲醇丙烷氨气消耗量
List<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
if (parGasValueList.size()>0){
if (kilnType==1){
List gasList=new ArrayList();
//氮气
List<ConsumeDataVo> nitConsume=new ArrayList<>();
//甲醇
List<ConsumeDataVo> metConsume=new ArrayList<>();
//丙烷
List<ConsumeDataVo> propaneConsume=new ArrayList<>();
//氨气
List<ConsumeDataVo> ammoniaConsume=new ArrayList<>();
for (ParGasValue parGasValue:parGasValueList
) {
consumeDataVo.setCreateTime(parGasValue.getCreateTime());
consumeDataVo.setValue(parGasValue.getNitFlowValue());
consumeDataVo.setName("氮气");
consumeDataVo.setUnit("");
nitConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getMethanolFlow());
consumeDataVo.setName("甲醇");
consumeDataVo.setUnit("");
metConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getPropaneFlow());
consumeDataVo.setName("丙烷");
consumeDataVo.setUnit("");
propaneConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getAmmoniaFlowValue());
consumeDataVo.setName("氨气");
consumeDataVo.setUnit("");
ammoniaConsume.add(consumeDataVo);
}
gasList.add(nitConsume);
gasList.add(metConsume);
gasList.add(propaneConsume);
gasList.add(ammoniaConsume);
jsonObject.put("gas",gasList);
}
if (kilnType==3){
List gasList=new ArrayList();
//氮气
List<ConsumeDataVo> nitConsume=new ArrayList<>();
//二氧化碳
List<ConsumeDataVo> carbonConsume=new ArrayList<>();
//氨气
List<ConsumeDataVo> ammoniaConsume=new ArrayList<>();
for (ParGasValue parGasValue:parGasValueList
) {
consumeDataVo.setCreateTime(parGasValue.getCreateTime());
consumeDataVo.setValue(parGasValue.getNitFlowValue());
consumeDataVo.setName("氮气");
consumeDataVo.setUnit("");
nitConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getCarDioxideFlowValue());
consumeDataVo.setName("二氧化碳");
consumeDataVo.setUnit("");
carbonConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getAmmoniaFlowValue());
consumeDataVo.setName("氨气");
consumeDataVo.setUnit("");
ammoniaConsume.add(consumeDataVo);
}
gasList.add(nitConsume);
gasList.add(carbonConsume);
gasList.add(ammoniaConsume);
jsonObject.put("gas",gasList);
}
}
//油搅拌转速趋势
List<ParRotSpeedValue> parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper<ParRotSpeedValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
if (parRotSpeedValueList.size()>0){
if (kilnType==1){
List rotList=new ArrayList();
List<ConsumeDataVo> rot1Consume=new ArrayList<>();
List<ConsumeDataVo> rot2Consume=new ArrayList<>();
for (ParRotSpeedValue parRotSpeedValue:parRotSpeedValueList
) {
consumeDataVo.setCreateTime(parRotSpeedValue.getCreateTime());
consumeDataVo.setValue(parRotSpeedValue.getOilStiSpeedAValue());
consumeDataVo.setName("1号油搅拌转速");
consumeDataVo.setUnit("转/min");
rot1Consume.add(consumeDataVo);
consumeDataVo.setValue(parRotSpeedValue.getOilStiSpeedBValue());
consumeDataVo.setName("2号油搅拌转速");
consumeDataVo.setUnit("转/min");
rot2Consume.add(consumeDataVo);
}
rotList.add(rot1Consume);
rotList.add(rot2Consume);
jsonObject.put("rot",rotList);
}
}
//温度趋势实际温度设定温度
List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
if (parTemValueList.size()>0){
if (kilnType==1){
List tempList=new ArrayList();
List<ConsumeDataVo> actualTempConsume=new ArrayList<>();
List<ConsumeDataVo> setupTempConsume=new ArrayList<>();
List<ConsumeDataVo> actualOilTempConsume=new ArrayList<>();
List<ConsumeDataVo> setupOilTempConsume=new ArrayList<>();
for (ParTemValue parTemValue:parTemValueList
) {
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("实际温度");
consumeDataVo.setValue(parTemValue.getActTemValue());
consumeDataVo.setUnit("");
actualTempConsume.add(consumeDataVo);
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("设定温度");
consumeDataVo.setValue(parTemValue.getSetTemValue());
consumeDataVo.setUnit("");
setupTempConsume.add(consumeDataVo);
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("油槽实际温度");
consumeDataVo.setValue(parTemValue.getOilTankActTemValue());
consumeDataVo.setUnit("");
actualOilTempConsume.add(consumeDataVo);
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("油槽设定温度");
consumeDataVo.setValue(parTemValue.getOilTankSetTemValue());
consumeDataVo.setUnit("");
setupOilTempConsume.add(consumeDataVo);
}
tempList.add(actualTempConsume);
tempList.add(setupTempConsume);
tempList.add(actualOilTempConsume);
tempList.add(setupOilTempConsume);
jsonObject.put("temp",tempList);
}
if (kilnType==2){
List tempList=new ArrayList();
List<ConsumeDataVo> actualTempConsume=new ArrayList<>();
List<ConsumeDataVo> setupTempConsume=new ArrayList<>();
for (ParTemValue parTemValue:parTemValueList
) {
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("实际温度");
consumeDataVo.setValue(parTemValue.getActTemValue());
consumeDataVo.setUnit("");
actualTempConsume.add(consumeDataVo);
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("设定温度");
consumeDataVo.setValue(parTemValue.getSetTemValue());
consumeDataVo.setUnit("");
setupTempConsume.add(consumeDataVo);
}
tempList.add(actualTempConsume);
tempList.add(setupTempConsume);
jsonObject.put("temp",tempList);
}
if (kilnType==3){
List tempList=new ArrayList();
List<ConsumeDataVo> actualTempConsume=new ArrayList<>();
List<ConsumeDataVo> setupTempConsume=new ArrayList<>();
List<ConsumeDataVo> outerZone1TempConsume=new ArrayList<>();
List<ConsumeDataVo> outerZone2TempConsume=new ArrayList<>();
for (ParTemValue parTemValue:parTemValueList
) {
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("实际温度");
consumeDataVo.setValue(parTemValue.getActTemValue());
consumeDataVo.setUnit("");
actualTempConsume.add(consumeDataVo);
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("设定温度");
consumeDataVo.setValue(parTemValue.getSetTemValue());
consumeDataVo.setUnit("");
setupTempConsume.add(consumeDataVo);
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("外一区温度");
consumeDataVo.setValue(parTemValue.getOuterZone1Temp());
consumeDataVo.setUnit("");
outerZone1TempConsume.add(consumeDataVo);
consumeDataVo.setCreateTime(parTemValue.getCreateTime());
consumeDataVo.setName("外二区温度");
consumeDataVo.setValue(parTemValue.getOuterZone2Temp());
consumeDataVo.setUnit("");
outerZone2TempConsume.add(consumeDataVo);
}
tempList.add(actualTempConsume);
tempList.add(setupTempConsume);
tempList.add(outerZone1TempConsume);
tempList.add(outerZone2TempConsume);
jsonObject.put("temp",tempList);
}
}
return R.ok(jsonObject.toJSONString());
}
}

View File

@ -24,9 +24,9 @@ public class AlarmInfoQueryParam extends BasePageParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "设备ID", required = false)
private Long equipmentID;
private Long equipmentId;
@ApiModelProperty(value = "报警类型", required = true)
@ApiModelProperty(value = "报警类型0窑炉1表示车辆", required = true)
private Integer type;
@ApiModelProperty(value = "开始时间", required = false)

View File

@ -0,0 +1,24 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2022/2/27 22:18
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "自动currTask参数", description = "自动currTask参数")
public class AutoCurrTaskParam extends BaseParam {
@ApiModelProperty(value = "详细信息", required = true)
private List<TaskCreateParam> taskCreateParamList;
}

View File

@ -0,0 +1,25 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: liguanghao
* @Date: 2022/3/3 23:09
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "自动任务参数", description = "自动任务参数")
public class AutoTaskParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "autoTaskId", required = true)
private Long id;
}

View File

@ -0,0 +1,28 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import com.mt.wms.core.params.BasePageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: liguanghao
* @Date: 2022/3/3 23:09
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "自动任务查询参数", description = "自动任务查询参数")
public class AutoTaskQueryParam extends BasePageParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "autoTaskId", required = true)
private Long id;
@ApiModelProperty(value = "任务状态:执行中、未执行", required = true)
private Integer status;
}

View File

@ -25,10 +25,13 @@ public class ElectricQueryParam extends BaseParam {
@ApiModelProperty(value = "窑炉id", required = true)
private Long kilnId;
@ApiModelProperty(value = "任务id", required = true)
private Long taskId;
@ApiModelProperty(value = "时间节点", required = true)
@ApiModelProperty(value = "时间节点", required = false)
private LocalDateTime time;
@ApiModelProperty(value = "时间类型:1 天2 周3 月4 年", required = true)
@ApiModelProperty(value = "时间类型:1 天2 周3 月4 年", required = false)
private Integer dateType;
}

View File

@ -0,0 +1,25 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: liguanghao
* @Date: 2022/2/27 22:23
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "工艺步骤参数", description = "工艺步骤参数")
public class StepInfoParam extends BaseParam {
@ApiModelProperty(value = "窑炉id", required = true)
private Long kilnId;
@ApiModelProperty(value = "工艺号id", required = true)
private Long craftId;
}

View File

@ -24,6 +24,10 @@ public class TaskCreateParam extends BaseParam {
// @ApiModelProperty(value = "托盘号")
// private String palletCode;
@ApiModelProperty(value = "自动任务类型", required = true)
private Integer autoTaskType;
@ApiModelProperty(value = "自动任务步骤标识", required = true)
private Integer autoTaskStep;
@ApiModelProperty(value = "起点(提升平台)", required = true)
private String startPosition;
@ApiModelProperty(value = "终点位置", required = true)

View File

@ -0,0 +1,51 @@
package com.mt.wms.empty.service;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.AutoTaskParam;
import com.mt.wms.empty.params.AutoTaskQueryParam;
import com.mt.wms.empty.vo.AutoTaskVo;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2022/3/3 23:14
* @Version 1.0
*/
public interface AutoTaskService {
/**
* 获取xx
*
* @param idParam 主键参数
* @return xx
*/
R<AutoTaskVo> get(IdParam idParam);
/**
* 获取xx列表
*
* @param autoTaskQueryParam xx查询参数
* @return xx列表
*/
R<List<AutoTaskVo>> list(AutoTaskQueryParam autoTaskQueryParam);
/**
* 获取xx分页列表
*
* @param autoTaskQueryParam xx查询参数
* @return xx分页列表
*/
R<PageVo<AutoTaskVo>> page(AutoTaskQueryParam autoTaskQueryParam);
/**
* 终止自动任务
*
* @param idParam xx参数
* @return 主键
*/
R<IdVo> stop(IdParam idParam);
}

View File

@ -6,6 +6,7 @@ import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.AutoCurrTaskParam;
import com.mt.wms.empty.params.CurrTaskQueryParam;
import com.mt.wms.empty.params.TaskCreateParam;
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
@ -82,4 +83,11 @@ public interface CurrTaskService {
* @return 结果
*/
R<PageVo<CurrTaskMainQueryVo>> currentTaskMainPage(BasePageParam param);
/**
* 执行任务
*/
R<String> runTask(Long taskId);
R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam);
}

View File

@ -33,7 +33,7 @@ public class AlarmInfoServiceImpl extends BaseService implements AlarmInfoServic
QueryWrapper<AlarmInfo> wrapper = new QueryWrapper<>();
wrapper.between(alarmInfoQueryParam.getStartTime() != null, AlarmInfo.CREATE_TIME, alarmInfoQueryParam.getStartTime(), alarmInfoQueryParam.getEndTime())
.eq(AlarmInfo.TYPE, alarmInfoQueryParam.getType())
.eq(alarmInfoQueryParam.getEquipmentID() != null, AlarmInfo.EQUIPMENT_ID, alarmInfoQueryParam.getEquipmentID())
.eq(alarmInfoQueryParam.getEquipmentId() != null, AlarmInfo.EQUIPMENT_ID, alarmInfoQueryParam.getEquipmentId())
.orderByDesc(AlarmInfo.CREATE_TIME);
Page<AlarmInfo> page = alarmInfoServiceBiz.page(new Page<>(alarmInfoQueryParam.getCurrent(), alarmInfoQueryParam.getSize()), wrapper);
return successful(new PageVo<>(page, AlarmInfoVo.class));

View File

@ -0,0 +1,77 @@
package com.mt.wms.empty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.wms.core.api.Assert;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.AutoExeTask;
import com.mt.wms.core.dal.entity.AutoExeTaskHis;
import com.mt.wms.core.dal.service.AutoExeTaskHisServiceBiz;
import com.mt.wms.core.dal.service.AutoExeTaskServiceBiz;
import com.mt.wms.core.errorcode.ApiErrorCode;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.AutoTaskParam;
import com.mt.wms.empty.params.AutoTaskQueryParam;
import com.mt.wms.empty.service.AutoTaskService;
import com.mt.wms.empty.vo.AutoTaskVo;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: liguanghao
* @Date: 2022/3/3 23:18
* @Version 1.0
*/
@Service
@Transactional
public class AutoTaskServiceImpl extends BaseService implements AutoTaskService {
@Resource
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Resource
private AutoExeTaskHisServiceBiz autoExeTaskHisServiceBiz;
@Override
public R<AutoTaskVo> get(IdParam idParam) {
Assert.notNull(ApiErrorCode.INVALID_PARAMETER,idParam.getId());
AutoExeTask autoExeTask=autoExeTaskServiceBiz.getById(idParam.getId());
AutoTaskVo autoTaskVo=AutoTaskVo.builder().build();
org.springframework.beans.BeanUtils.copyProperties(autoExeTask,autoTaskVo);
return successful(autoTaskVo);
}
@Override
public R<List<AutoTaskVo>> list(AutoTaskQueryParam autoTaskQueryParam) {
return null;
}
@Override
public R<PageVo<AutoTaskVo>> page(AutoTaskQueryParam autoTaskQueryParam) {
QueryWrapper<AutoExeTask> wrapper=new QueryWrapper<>();
wrapper.eq((autoTaskQueryParam.getStatus()!=null&&("").equals(autoTaskQueryParam.getStatus())),AutoExeTask.STATUS,autoTaskQueryParam.getStatus());
Page<AutoExeTask> page = autoExeTaskServiceBiz.page(new Page<>(autoTaskQueryParam.getCurrent(), autoTaskQueryParam.getSize()), wrapper);
return successful(new PageVo<>(page,AutoTaskVo.class));
}
@Override
public R<IdVo> stop(IdParam idParam) {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(idParam.getId());
//状态置为终止
autoExeTask.setStatus(3);
autoExeTaskServiceBiz.updateById(autoExeTask);
//记录到自动任务历史表
AutoExeTaskHis autoExeTaskHis=new AutoExeTaskHis();
BeanUtils.copyProperties(autoExeTask,autoExeTaskHis);
autoExeTaskHisServiceBiz.save(autoExeTaskHis);
//释放后续步骤
// TODO: 2022/3/3
autoExeTaskServiceBiz.removeById(autoExeTask);
return null;
}
}

View File

@ -1,38 +1,43 @@
package com.mt.wms.empty.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.wms.core.api.Assert;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.CraftInfoServiceBiz;
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.params.BasePageParam;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.utils.IDGenerator;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.controller.ApmsController;
import com.mt.wms.empty.enums.TaskTypeEnum;
import com.mt.wms.empty.params.AutoCurrTaskParam;
import com.mt.wms.empty.params.CurrTaskQueryParam;
import com.mt.wms.empty.params.TaskCreateParam;
import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.empty.service.CurrTaskService;
import com.mt.wms.empty.service.TaskDetHisService;
import com.mt.wms.empty.service.TaskHisService;
import com.mt.wms.empty.task.TaskDistanceUtils;
import com.mt.wms.empty.vo.ApmsEndProcessVo;
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
import com.mt.wms.empty.vo.CurrTaskQueryVo;
import com.mt.wms.empty.vo.CurrTaskVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import java.util.*;
/**
* 服务实现类
@ -45,6 +50,7 @@ import java.util.List;
@Transactional
public class CurrTaskServiceImpl extends BaseService implements CurrTaskService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
CurrTaskServiceBiz currTaskServiceBiz;
@ -64,6 +70,10 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
OrderInfoServiceBiz orderInfoServiceBiz;
@Autowired
CraftInfoServiceBiz craftInfoServiceBiz;
@Autowired
VehicleInfoServiceBiz vehicleInfoServiceBiz;
@Autowired
TaskDistanceUtils taskDistanceUtils;
@Override
public CurrTaskVo getCurrTask(IdParam idParam) {
@ -132,7 +142,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
@Override
public R<String> deleteBySheetNo(String sheetNo) {
CurrTask byId = currTaskServiceBiz.getById(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
CurrTask byId = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
//如果尚未执行状态 0
if (byId.getStatus() == 0)
{
@ -185,4 +195,15 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
});
return successful(pageVo);
}
@Override
public R<String> runTask(Long taskId) {
CurrTask currTask = currTaskServiceBiz.getById(taskId);
return null;
}
@Override
public R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam) {
return null;
}
}

View File

@ -3,13 +3,19 @@ package com.mt.wms.empty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.InStockInfo;
import com.mt.wms.core.dal.entity.InStockInfoHis;
import com.mt.wms.core.dal.entity.RunTask;
import com.mt.wms.core.dal.entity.VehicleInfo;
import com.mt.wms.core.dal.service.InStockInfoHisServiceBiz;
import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
import com.mt.wms.core.dal.service.RunTaskServiceBiz;
import com.mt.wms.core.dal.service.VehicleInfoServiceBiz;
import com.mt.wms.core.dal.service.impl.InStockInfoHisServiceBizImpl;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.OutStockParam;
import com.mt.wms.empty.service.OutStockService;
import com.mt.wms.empty.task.AsynRunTaskService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -33,11 +39,14 @@ public class OutStockServiceImpl extends BaseService implements OutStockService
private AsynRunTaskService asynRunTaskService;
@Resource
private InStockInfoServiceBiz inStockInfoServiceBiz;
@Resource
private RunTaskServiceBiz runTaskServiceBiz;
@Override
public R<String> outTask(OutStockParam outStockParam) {
// TODO: 2021/12/17 出库
Long localtionId = outStockParam.getLocaltionId();
Long locationId = outStockParam.getLocaltionId();
//提升台
Integer code = outStockParam.getCode();
//查询是否有空闲车辆若有占用车辆若无返回暂无可用车辆
@ -52,14 +61,22 @@ public class OutStockServiceImpl extends BaseService implements OutStockService
}else {
return R.failed("暂无可用车辆!请稍后重试!");
}
//生成调度任务
RunTask runTask=new RunTask();
runTask.setBeginTime(LocalDateTime.now());
runTask.setVehicleId(vehicleInfoList.get(0).getId());
// TODO: 2021/12/22 库位id对应的位置 提升平台对应的位置
runTask.setStartPosition("库位位置");
runTask.setEndPosition("提升台位置");
setCommonField(runTask);
runTaskServiceBiz.save(runTask);
//异步调用车辆
asynRunTaskService.asynRunOutStock();
asynRunTaskService.asynRunOutStock(runTask.getId(),locationId);
//修改库位状态
InStockInfo inStockInfo = inStockInfoServiceBiz
.getOne(new QueryWrapper<InStockInfo>().eq("Location_id", localtionId));
.getOne(new QueryWrapper<InStockInfo>().eq("Location_id", locationId));
inStockInfo.setStatus(1);
inStockInfoServiceBiz.updateById(inStockInfo);
return R.ok("操作成功");
}
}

View File

@ -5,9 +5,11 @@ import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.CurrTaskDet;
import com.mt.wms.core.dal.entity.InStockInfo;
import com.mt.wms.core.dal.entity.Location;
import com.mt.wms.core.dal.entity.OrderInfo;
import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz;
import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
import com.mt.wms.core.dal.service.LocationServiceBiz;
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.StockInfoQueryParam;
@ -36,11 +38,18 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic
private LocationServiceBiz locationServiceBiz;
@Resource
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
@Resource
private OrderInfoServiceBiz orderInfoServiceBiz;
@Override
public R<List<CurrTaskDetVo>> get(IdParam idParam) {
Long taskId = inStockInfoServiceBiz.getById(idParam).getTaskId();
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq("curr_task_id", taskId));
List<CurrTaskDetVo> currTaskDetVoList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class);
for (CurrTaskDetVo currTaskDetVo:currTaskDetVoList
) {
String costomerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq("order_no", currTaskDetVo.getOrderNo())).getCustomerName();
currTaskDetVo.setCustomer(costomerName);
}
return successful(currTaskDetVoList);
}
@ -55,11 +64,13 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic
//库位为空
if (location.getStatus()!=1){
stockInfoVo.setEmpty(1);
stockInfoVo.setLocaltionId(location.getId());
stockInfoVo.setLocationId(location.getId());
stockInfoVo.setLocationName(location.getLocationNameAlias());
}else {
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>()
.eq("localtion_id", location.getId()));
.eq("location_id", location.getId()));
BeanUtils.copyProperties(inStockInfo,stockInfoVo);
stockInfoVo.setEmpty(0);
}
stockInfoVoList.add(stockInfoVo);
}

View File

@ -1,18 +1,28 @@
package com.mt.wms.empty.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.utils.IDGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @Author: liguanghao
@ -32,11 +42,75 @@ public class AsynRunTaskService extends BaseService {
private LocationServiceBiz locationServiceBiz;
@Resource
private InStockInfoServiceBiz inStockInfoServiceBiz;
@Resource
private InStockInfoHisServiceBiz inStockInfoHisServiceBiz;
@Resource
private TaskDistanceUtils taskDistanceUtils;
@Resource
private VehicleInfoServiceBiz vehicleInfoServiceBiz;
@Resource
private PointInfoServiceBiz pointInfoServiceBiz;
@Resource
private KilnInfoServiceBiz kilnInfoServiceBiz;
@Resource
private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz;
@Resource
private ParTemValueServiceBiz parTemValueServiceBiz;
@Resource
private ParEleValueServiceBiz parEleValueServiceBiz;
@Resource
private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
@Resource
private ParGasValueServiceBiz parGasValueServiceBiz;
//窑炉可用未满的情况下调用车辆起点为提升台终点为窑炉
@Async("asyncServiceExecutor")
public void asynRunTask(Long currTaskId,Long vehicleId){
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
Integer otherNowPoint=0;
if (vehicleId==1){
// TODO: 2022/2/26 获取RGV2当前位置
otherNowPoint=1;
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), otherNowPoint);
while (conflictBoolean){
//若冲突
// TODO: 2022/2/26 执行小车移位任务移位任务完成后再判断是否冲突,移位任务可以直接让小车移位到两端
Map<String, Integer> json = new HashMap();
//type=1为
// taskType 4 单移动
json.put("taskType", 4);
json.put("sendRow", 39);
String taskJson = JSON.toJSONString(json);
try {
HttpClient.httpPost("http://localhost:8009/rgv2/sendTask",taskJson);
} catch (IOException e) {
e.printStackTrace();
logger.error(new Date() + "WCS接口超时未响应");
}
}
}else {
//获取RGV1当前位置
otherNowPoint=2;
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), otherNowPoint);
while (conflictBoolean){
//若冲突
// TODO: 2022/2/26 执行小车移位任务移位任务完成后再判断是否冲突,移位任务可以直接让小车移位到两端
Map<String, Integer> json = new HashMap();
// taskType 4 单移动
json.put("taskType", 4);
json.put("sendRow", 1);
String taskJson = JSON.toJSONString(json);
try {
HttpClient.httpPost("http://localhost:8009/rgv1/sendTask",taskJson);
} catch (IOException e) {
e.printStackTrace();
logger.error(new Date() + "WCS接口超时未响应");
}
}
}
//新建一条执行任务的关系表存放任务执行信息
RunTask runTask=new RunTask();
runTask.setTaskId(currTask.getId());
@ -48,9 +122,33 @@ public class AsynRunTaskService extends BaseService {
runTask.setBeginTime(LocalDateTime.now());
runTaskServiceBiz.save(runTask);
// TODO: 2021/12/14 调用车辆填入起终点,得到车辆执行结果
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
Map<String, Object> json = new HashMap();
// taskType 1 搬运
json.put("taskType", 1);
json.put("sendRow", endPoint);
json.put("pickRow",startPoint);
json.put("taskNo",currTaskId);
json.put("ideNumber",1);
json.put("processNumber",currTask.getPlcValue());
String taskJson = JSON.toJSONString(json);
String result =null;
try {
if (vehicleId==1){
result = HttpClient.httpPost("http://localhost:8009/rgv1/sendTask", taskJson);
}
if (vehicleId==2){
result = HttpClient.httpPost("http://localhost:8009/rgv2/sendTask", taskJson);
}
} catch (IOException e) {
e.printStackTrace();
logger.error(new Date() + "WCS接口超时未响应");
}
JSONObject jsonObject = JSON.parseObject(result);
int status = Integer.parseInt(String.valueOf(jsonObject.get("msg")));
//执行成功,托盘进炉
if (true){
if (status==1){
//更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
runTask.setEndTime(LocalDateTime.now());
@ -61,21 +159,104 @@ public class AsynRunTaskService extends BaseService {
currTask.setRunTaskId(runTask.getId());
currTask.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
//更新小车状态
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
logger.info("任务 "+currTask.getTaskCode()+" 车辆从液压台台到窑炉过程中失败。");
// TODO: 2021/12/14 websocket推送到前端,小车管理界面添加一个重置小车状态的接口
}
}
// TODO: 2022/2/26 修改下面的 方法加上小车操作如上
//窑炉可用未满的情况下调用车辆起点为缓存区终点为窑炉
public void asynRunTaskForStockToKiln(Long stockInfokId,Long vehicleId){
InStockInfo inStockInfo = inStockInfoServiceBiz.getById(stockInfokId);
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
Long currTaskId = inStockInfo.getTaskId();
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
Integer otherNowPoint=0;
if (vehicleId==1){
// TODO: 2022/2/26 获取RGV2当前位置
otherNowPoint=1;
}else {
//获取RGV1当前位置
otherNowPoint=2;
}
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), currTask.getTargetPosition(), otherNowPoint);
while (conflictBoolean){
//若冲突
// TODO: 2022/2/26 执行小车移位任务移位任务完成后再判断是否冲突,移位任务可以直接让小车移位到两端
}
//新建一条执行任务的关系表存放任务执行信息
RunTask runTask=new RunTask();
runTask.setTaskId(currTask.getId());
runTask.setTaskCode(currTask.getTaskCode());
runTask.setVehicleId(vehicleId);
// TODO: 2022/2/16 起点为库位
runTask.setStartPosition(location.getCode());
runTask.setEndPosition(currTask.getTargetPosition());
setCommonField(runTask);
runTask.setBeginTime(LocalDateTime.now());
runTaskServiceBiz.save(runTask);
//修改缓存区存储情况表状态
inStockInfo.setStatus(1);
inStockInfoServiceBiz.updateById(inStockInfo);
// TODO: 2021/12/14 调用车辆填入起终点,得到车辆执行结果
//执行成功,托盘进炉
if (true){
//更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
runTask.setEndTime(LocalDateTime.now());
runTask.setStatus(2);
runTaskServiceBiz.updateById(runTask);
//更改缓存区存储状态,添加缓存区存储历史情况记录
inStockInfo.setStatus(2);
inStockInfoServiceBiz.updateById(inStockInfo);
InStockInfoHis inStockInfoHis=new InStockInfoHis();
BeanUtils.copyProperties(inStockInfo,inStockInfoHis);
inStockInfoHisServiceBiz.save(inStockInfoHis);
inStockInfoServiceBiz.removeById(inStockInfo);
//更新currTask表状态
currTask.setIsIn(1);
currTask.setRunTaskId(runTask.getId());
currTask.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
logger.info("任务 "+currTask.getTaskCode()+" 车辆从提升平台到窑炉过程中失败。");
// TODO: 2021/12/14 websocket推送到前端
// TODO: 2021/12/14 websocket推送到前端,执行失败后车辆在中途缓存区存储情况怎么修改
}
}
//窑炉已满调用车辆起点为提升台终点为缓存区
@Async("asyncServiceExecutor")
public void asynRunTaskToWarehouse(Long currTaskId,Long vehicleId){
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
Location location = locationServiceBiz.list(new QueryWrapper<Location>()
.eq(Location.STATUS, 1)
.eq(Location.VALID, 1)).get(0);
Location location = locationServiceBiz.getById(currTask.getLocationId());
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
Integer otherNowPoint=0;
if (vehicleId==1){
// TODO: 2022/2/26 获取RGV2当前位置
otherNowPoint=1;
}else {
//获取RGV1当前位置
otherNowPoint=2;
}
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), otherNowPoint);
while (conflictBoolean){
//若冲突
// TODO: 2022/2/26 执行小车移位任务移位任务完成后再判断是否冲突,移位任务可以直接让小车移位到两端
}
PointInfo pointOfLocation = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode()));
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask=new RunTask();
setCommonField(runTask);
@ -86,10 +267,7 @@ public class AsynRunTaskService extends BaseService {
runTask.setStartPosition(currTask.getStartPosition());
runTask.setEndPosition(location.getCode());
runTaskServiceBiz.save(runTask);
//更新 location 表对应库位状态为占用
location.setStatus(1);
location.setUpdateTime(LocalDateTime.now());
locationServiceBiz.updateById(location);
//添加一条库位详情到in_stock_info表
InStockInfo inStockInfo=new InStockInfo();
inStockInfo.setStatus(1);
@ -103,12 +281,6 @@ public class AsynRunTaskService extends BaseService {
inStockInfo.setType(1);
setCommonField(inStockInfo);
inStockInfoServiceBiz.save(inStockInfo);
//修改currTask的是否缓存,库位id,库位名称
currTask.setIsCache(1);
currTask.setCacheRunTaskId(runTask.getId());
currTask.setLocationId(location.getId());
currTask.setLocationName(location.getLocationNameAlias());
currTaskServiceBiz.updateById(currTask);
// TODO: 2021/12/14 调用车辆填入起终点,得到车辆执行结果,填入任务号待确认
if (true){
@ -125,22 +297,545 @@ public class AsynRunTaskService extends BaseService {
inStockInfo.setStatus(2);
inStockInfo.setInTime(LocalDateTime.now());
inStockInfoServiceBiz.updateById(inStockInfo);
//更新小车状态
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
logger.info("任务 "+currTask.getTaskCode()+" 车辆从提升平台到缓存区过程中失败。");
logger.info("任务 "+currTask.getTaskCode()+" 车辆从液压台到缓存区过程中失败。");
// TODO: 2021/12/14 websocket推送到前端
}
}
//窑炉加工完成调用车辆入库到缓存区
@Async("asyncServiceExecutor")
public void asynRunTaskForKilnToWarehouse(Long kilnId,Long vehicleId){
public void asynRunTaskForKilnToWarehouse(Long currTaskId,Long vehicleId){
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
Integer otherNowPoint=0;
if (vehicleId==1){
// TODO: 2022/2/26 获取RGV2当前位置
otherNowPoint=1;
}else {
//获取RGV1当前位置
otherNowPoint=2;
}
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), otherNowPoint);
while (conflictBoolean){
//若冲突
// TODO: 2022/2/26 执行小车移位任务移位任务完成后再判断是否冲突,移位任务可以直接让小车移位到两端
}
// TODO: 2021/12/28 location排序
Location location = locationServiceBiz.list(new QueryWrapper<Location>()
.eq(Location.STATUS, 1)
.eq(Location.VALID, 1)).get(0);
currTask.setOutStartPosition(currTask.getTargetPosition());
// location对应的点位
//String outTargetPosition = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode())).getCode();
currTask.setOutTargetPosition(location.getCode());
currTaskServiceBiz.updateById(currTask);
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask=new RunTask();
setCommonField(runTask);
runTask.setTaskId(currTask.getId());
runTask.setTaskCode(currTask.getTaskCode());
runTask.setVehicleId(vehicleId);
runTask.setBeginTime(LocalDateTime.now());
runTask.setStartPosition(currTask.getOutStartPosition());
runTask.setEndPosition(currTask.getOutTargetPosition());
runTaskServiceBiz.save(runTask);
//更新 location 表对应库位状态为占用
location.setStatus(1);
location.setUpdateTime(LocalDateTime.now());
locationServiceBiz.updateById(location);
currTask.setOutRunTaskId(runTask.getId());
currTaskServiceBiz.updateById(currTask);
//添加一条库位详情到in_stock_info表
InStockInfo inStockInfo=new InStockInfo();
inStockInfo.setStatus(1);
inStockInfo.setInterCode(IDGenerator.gen("HCT", "yyyyMMddHHmm", 2, "WAREHOUSE_CODE"));
inStockInfo.setTaskId(currTask.getId());
inStockInfo.setTaskCode(currTask.getTaskCode());
inStockInfo.setKilnId(currTask.getKilnId());
inStockInfo.setKilnName(currTask.getKilnName());
inStockInfo.setLocationId(location.getId());
inStockInfo.setLocationName(location.getLocationNameAlias());
inStockInfo.setType(0);
setCommonField(inStockInfo);
inStockInfoServiceBiz.save(inStockInfo);
// TODO: 2021/12/14 调用车辆填入起终点,得到车辆执行结果,填入任务号待确认
if (true){
//更新关系表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
runTask.setStatus(2);
runTask.setEndTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
//更新currTask表
currTask.setIsOut(2);
currTask.setUpdateTime(LocalDateTime.now());
currTask.setStatus(2);
currTaskServiceBiz.updateById(currTask);
//更新in_stock_info表
inStockInfo.setStatus(2);
inStockInfo.setInTime(LocalDateTime.now());
inStockInfoServiceBiz.updateById(inStockInfo);
//更新小车状态
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
logger.info("任务 "+currTask.getTaskCode()+" 车辆从窑炉到缓存区过程中失败。");
// TODO: 2021/12/14 websocket推送到前端
}
}
//出库起点为缓存区库位终点为提升台
@Async("asyncServiceExecutor")
public void asynRunOutStock(){
public void asynRunOutStock(Long runTaskId,Long locationId){
//修改调度任务状态
RunTask runTask = runTaskServiceBiz.getById(runTaskId);
//修改缓存区状态
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>()
.eq("location_id", locationId));
inStockInfo.setStatus(1);
inStockInfoServiceBiz.updateById(inStockInfo);
// TODO: 2021/12/14 调用车辆填入起终点,得到车辆执行结果,填入任务号待确认
if (true){
//更新关系表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
runTask.setStatus(2);
runTask.setEndTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
//更新in_stock_info表
inStockInfo.setStatus(2);
inStockInfo.setInTime(LocalDateTime.now());
inStockInfoServiceBiz.updateById(inStockInfo);
//缓存区存储历史
InStockInfoHis inStockInfoHis=new InStockInfoHis();
BeanUtils.copyProperties(inStockInfo,inStockInfoHis);
inStockInfoHisServiceBiz.save(inStockInfoHis);
inStockInfoServiceBiz.removeById(inStockInfo.getId());
//更新库位状态
Location location = locationServiceBiz.getById(locationId);
location.setStatus(0);
locationServiceBiz.updateById(location);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
logger.info("任务 "+runTask.getTaskCode()+" 车辆从缓存区到提升平台过程中失败。");
// TODO: 2021/12/14 websocket推送到前端
}
}
//允许进炉信号为true记录开始加工时的能源消耗数据再写定时任务记录加工过程的消耗数据再写一个异步方法加工任务结束的时候记录一下各项消耗的值
public void asynStartRecordConsume(Long currTaskId,Long kilnId){
// TODO: 2022/2/17
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.EQ_TYPE, 0));
String nameSpaceNote = nameSpace.getNote();
switch (kilnInfo.getType()){
//加工炉
case 1:
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
//油槽实际温度
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
//油槽设定温度
Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp");
ParTemValue parTemValue=new ParTemValue();
parTemValue.setSetTemValue(setUpTemp.floatValue());
parTemValue.setActTemValue(actualTemp.floatValue());
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
parTemValue.setKilnId(kilnId);
parTemValue.setTaskId(currTaskId);
setCommonField(parTemValue);
parTemValueServiceBiz.save(parTemValue);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue=new ParEleValue();
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue.setTotalBat(electricalValue.floatValue());
parEleValue.setKilnId(kilnId);
parEleValue.setTaskId(currTaskId);
setCommonField(parEleValue);
parEleValueServiceBiz.save(parEleValue);
//一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
//二号油搅拌转速
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue();
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
parRotSpeedValue.setKilnId(kilnId);
parRotSpeedValue.setTaskId(currTaskId);
setCommonField(parRotSpeedValue);
parRotSpeedValueServiceBiz.save(parRotSpeedValue);
//氮气
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
//甲烷
Double methanolFlow = readPlc(nameSpaceNote, "MethanolFlow");
//丙烷
Double propaneFlow = readPlc(nameSpaceNote, "PropaneFlow");
//氨气
Double ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow");
//实际碳势
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定碳势
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
ParGasValue parGasValue=new ParGasValue();
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue.setMethanolFlow(methanolFlow.floatValue());
parGasValue.setPropaneFlow(propaneFlow.floatValue());
parGasValue.setActualNitPotValue(actualCarbon.floatValue());
parGasValue.setSetNitPotValue(setupCarbon.floatValue());
parGasValue.setKilnId(kilnId);
parGasValue.setTaskId(currTaskId);
setCommonField(parGasValue);
parGasValueServiceBiz.save(parGasValue);
break;
//回火炉
case 2:
//实际温度
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
ParTemValue parTemValue2=new ParTemValue();
parTemValue2.setSetTemValue(setUpTemp.floatValue());
parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId);
parTemValue2.setTaskId(currTaskId);
setCommonField(parTemValue2);
parTemValueServiceBiz.save(parTemValue2);
//电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
//A向电压
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue2=new ParEleValue();
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue2.setTotalBat(electricalValue.floatValue());
parEleValue2.setKilnId(kilnId);
parEleValue2.setTaskId(currTaskId);
setCommonField(parEleValue2);
parEleValueServiceBiz.save(parEleValue2);
break;
//氮化炉
case 3:
//实际温度
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
//炉压
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
//外一区温度
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
//外二区温度
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
ParTemValue parTemValue3=new ParTemValue();
parTemValue3.setSetTemValue(setUpTemp.floatValue());
parTemValue3.setActTemValue(actualTemp.floatValue());
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
parTemValue3.setOuterZone2Temp(outerZone2Temperature.floatValue());
parTemValue3.setFurnacePressure(furnacePressure.floatValue());
parTemValue3.setKilnId(kilnId);
parTemValue3.setTaskId(currTaskId);
setCommonField(parTemValue3);
parTemValueServiceBiz.save(parTemValue3);
//电度值
electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
//A向电压
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue3=new ParEleValue();
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue3.setTotalBat(electricalValue.floatValue());
parEleValue3.setKilnId(kilnId);
parEleValue3.setTaskId(currTaskId);
setCommonField(parEleValue3);
parEleValueServiceBiz.save(parEleValue3);
//实际氮势
actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定氮势
setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
//氢含量
Double hydrogenContent = readPlc(nameSpaceNote, "HydrogenContent");
//分解率
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
//氨气量
ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow");
//氮气量
nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow");
//二氧化碳量
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CarbonDioxideFlow");
ParGasValue parGasValue3=new ParGasValue();
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
parGasValue3.setSetNitPotValue(setupCarbon.floatValue());
parGasValue3.setHydrogenContent(hydrogenContent.floatValue());
parGasValue3.setDecompositionRate(decompositionRate.floatValue());
parGasValue3.setKilnId(kilnId);
parGasValue3.setTaskId(currTaskId);
setCommonField(parGasValue3);
parGasValueServiceBiz.save(parGasValue3);
break;
//清洗炉
case 4:
//电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
//A向电压
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue4=new ParEleValue();
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue4.setTotalBat(electricalValue.floatValue());
parEleValue4.setKilnId(kilnId);
parEleValue4.setTaskId(currTaskId);
setCommonField(parEleValue4);
parEleValueServiceBiz.save(parEleValue4);
break;
default:
logger.info("任务:"+currTaskId+"开始在"+kilnInfo.getKilnName()+"加工,能源消耗开始统计。");
}
}
//允许出炉信号为true记录结束加工时的能源消耗数据
public void asynEndRecordConsume(Long currTaskId,Long kilnId){
// TODO: 2022/2/17
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.EQ_TYPE, 0));
String nameSpaceNote = nameSpace.getNote();
switch (kilnInfo.getType()){
//加工炉
case 1:
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
//油槽实际温度
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
//油槽设定温度
Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp");
ParTemValue parTemValue=new ParTemValue();
parTemValue.setSetTemValue(setUpTemp.floatValue());
parTemValue.setActTemValue(actualTemp.floatValue());
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
parTemValue.setKilnId(kilnId);
parTemValue.setTaskId(currTaskId);
setCommonField(parTemValue);
parTemValueServiceBiz.save(parTemValue);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue=new ParEleValue();
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue.setTotalBat(electricalValue.floatValue());
parEleValue.setKilnId(kilnId);
parEleValue.setTaskId(currTaskId);
setCommonField(parEleValue);
parEleValueServiceBiz.save(parEleValue);
//一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
//二号油搅拌转速
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue();
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
parRotSpeedValue.setKilnId(kilnId);
parRotSpeedValue.setTaskId(currTaskId);
setCommonField(parRotSpeedValue);
parRotSpeedValueServiceBiz.save(parRotSpeedValue);
//氮气
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
//甲烷
Double methanolFlow = readPlc(nameSpaceNote, "MethanolFlow");
//丙烷
Double propaneFlow = readPlc(nameSpaceNote, "PropaneFlow");
//氨气
Double ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow");
//实际碳势
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定碳势
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
ParGasValue parGasValue=new ParGasValue();
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue.setMethanolFlow(methanolFlow.floatValue());
parGasValue.setPropaneFlow(propaneFlow.floatValue());
parGasValue.setActualNitPotValue(actualCarbon.floatValue());
parGasValue.setSetNitPotValue(setupCarbon.floatValue());
parGasValue.setKilnId(kilnId);
parGasValue.setTaskId(currTaskId);
setCommonField(parGasValue);
parGasValueServiceBiz.save(parGasValue);
break;
//回火炉
case 2:
//实际温度
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
ParTemValue parTemValue2=new ParTemValue();
parTemValue2.setSetTemValue(setUpTemp.floatValue());
parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId);
parTemValue2.setTaskId(currTaskId);
setCommonField(parTemValue2);
parTemValueServiceBiz.save(parTemValue2);
//电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
//A向电压
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue2=new ParEleValue();
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue2.setTotalBat(electricalValue.floatValue());
parEleValue2.setKilnId(kilnId);
parEleValue2.setTaskId(currTaskId);
setCommonField(parEleValue2);
parEleValueServiceBiz.save(parEleValue2);
break;
//氮化炉
case 3:
//实际温度
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
//炉压
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
//外一区温度
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
//外二区温度
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
ParTemValue parTemValue3=new ParTemValue();
parTemValue3.setSetTemValue(setUpTemp.floatValue());
parTemValue3.setActTemValue(actualTemp.floatValue());
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
parTemValue3.setOuterZone2Temp(outerZone2Temperature.floatValue());
parTemValue3.setFurnacePressure(furnacePressure.floatValue());
parTemValue3.setKilnId(kilnId);
parTemValue3.setTaskId(currTaskId);
setCommonField(parTemValue3);
parTemValueServiceBiz.save(parTemValue3);
//电度值
electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
//A向电压
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue3=new ParEleValue();
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue3.setTotalBat(electricalValue.floatValue());
parEleValue3.setKilnId(kilnId);
parEleValue3.setTaskId(currTaskId);
setCommonField(parEleValue3);
parEleValueServiceBiz.save(parEleValue3);
//实际氮势
actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定氮势
setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
//氢含量
Double hydrogenContent = readPlc(nameSpaceNote, "HydrogenContent");
//分解率
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
//氨气量
ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow");
//氮气量
nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow");
//二氧化碳量
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CarbonDioxideFlow");
ParGasValue parGasValue3=new ParGasValue();
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
parGasValue3.setSetNitPotValue(setupCarbon.floatValue());
parGasValue3.setHydrogenContent(hydrogenContent.floatValue());
parGasValue3.setDecompositionRate(decompositionRate.floatValue());
parGasValue3.setKilnId(kilnId);
parGasValue3.setTaskId(currTaskId);
setCommonField(parGasValue3);
parGasValueServiceBiz.save(parGasValue3);
break;
//清洗炉
case 4:
//电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
//A向电压
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue4=new ParEleValue();
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue4.setTotalBat(electricalValue.floatValue());
parEleValue4.setKilnId(kilnId);
parEleValue4.setTaskId(currTaskId);
setCommonField(parEleValue4);
parEleValueServiceBiz.save(parEleValue4);
break;
default:
logger.info("任务:"+currTaskId+"开始在"+kilnInfo.getKilnName()+"加工,能源消耗开始统计。");
}
}
/**
* 获取变量值
* @param nameSpace nameSpace前缀
* @param variableName 变量名称
* @return 变量值
*/
private Double readPlc(String nameSpace, String variableName){
String identifier=nameSpace.concat(variableName);
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
String result = null;
try {
result = HttpClient.httpPost("http://localhost:8009/opcua/read", JSON.toJSONString(json));
} catch (IOException e) {
e.printStackTrace();
logger.info("能源消耗统计:获取 "+identifier+" 的值失败");
}
return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
}
}

View File

@ -1,23 +1,38 @@
package com.mt.wms.empty.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.vo.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.bouncycastle.asn1.x500.style.RFC4519Style.l;
/**
* @Author: liguanghao
* @Date: 2021/11/15 21:55
* @Version 1.0
*/
@Component
@Transactional
public class RunTaskUtils {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private CurrTaskServiceBiz currTaskServiceBiz;
@Resource
@ -28,6 +43,14 @@ public class RunTaskUtils {
private AsynRunTaskService asynRunTaskService;
@Resource
private VehicleInfoServiceBiz vehicleInfoServiceBiz;
@Resource
private TaskDistanceUtils taskDistanceUtils;
@Resource
private PointInfoServiceBiz pointInfoServiceBiz;
@Resource
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Resource
private KilnInfoServiceBiz kilnInfoServiceBiz;
/**
* 进炉加工
@ -35,9 +58,39 @@ public class RunTaskUtils {
* @return
* @throws InterruptedException
*/
public R runTaskForInKiln(Integer currTaskId) throws InterruptedException {
public R runTaskForInKiln(Long currTaskId) throws InterruptedException {
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
//传入任务id,起始点若终点是窑炉获取窑炉状态
//起点,起点和终点是液压台code窑炉code缓存区code
String startPosition = currTask.getStartPosition();
PointInfo startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, startPosition));
// 可以根据点位类型判断起点是否为液压台
Integer startPointType = startPoint.getType();
if (startPointType==3){
Map<String, Object> yeya = new HashMap();
//type=1为
yeya.put("type", 1);
yeya.put("number", startPoint.getCode());
String yeyaJudgeStatus = JSON.toJSONString(yeya);
//判断起点液压台是否已放货且提升到位
String yeyaStatus=null;
try {
yeyaStatus = HttpClient.httpPost("http://localhost:8009/yeya/isReadyForYeyaStatus", yeyaJudgeStatus);
} catch (IOException e) {
e.printStackTrace();
logger.error(new Date() + "WCS接口超时未响应");
}
//taskStatus==3满足条件其他状态值说明液压台不满足开始任务的条件无货物或者有货物但是没提升到位
if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 3){
return R.failed(startPoint.getName()+"号液压台不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!");
}
}
//是否有小车在运行
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
if (vehicleInfoList.size()>0){
//有小车在运行提示当前有车辆在运行请稍后
return R.failed("当前轨道有RGV车辆在运动请等待当前RGV车辆执行完毕再执行任务");
}
// TODO: 2022/2/27 传入任务id,起始点若终点是窑炉获取窑炉状态
int kilnStatus = 1;
//窑炉状态为不可用
@ -46,25 +99,20 @@ public class RunTaskUtils {
}
//窑炉可用未满
if (kilnStatus==1){
//查询是否有空闲车辆若有占用车辆若无返回暂无可用车辆
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
.eq(VehicleInfo.STATUS, 0)
.eq(VehicleInfo.VALID, 1));
if (vehicleInfoList.size()>0){
VehicleInfo vehicleInfo = vehicleInfoList.get(0);
//计算出路径最短的车辆id
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition());
//占用车辆
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
}else {
return R.failed("暂无可用车辆!请稍后重试!");
}
//更改任务状态为执行中
currTask.setStatus(1);
currTask.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
//异步调用车辆
asynRunTaskService.asynRunTask(currTask.getId(),vehicleInfoList.get(0).getId());
return R.ok("操作成功");
asynRunTaskService.asynRunTask(currTask.getId(),vehicleId);
return R.ok("操作成功,任务已开始执行。");
}
//窑炉已满
if (kilnStatus==2){
@ -74,26 +122,32 @@ public class RunTaskUtils {
.eq(Location.VALID, 1));
//缓存区未满
if (count >0) {
//查询是否有空闲车辆若有占用车辆若无返回暂无可用车辆
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
.eq(VehicleInfo.STATUS, 0)
.eq(VehicleInfo.VALID, 1));
if (vehicleInfoList.size()>0){
VehicleInfo vehicleInfo = vehicleInfoList.get(0);
//分配一个缓存区库位
Location location = locationServiceBiz.list(new QueryWrapper<Location>()
.eq(Location.STATUS, 1)
.eq(Location.VALID, 1)).get(0);
//更新 location 表对应库位状态为占用
location.setStatus(1);
location.setUpdateTime(LocalDateTime.now());
locationServiceBiz.updateById(location);
//通过库位code去point_info表中查出该库位对应的点
PointInfo pointInfo = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode()));
//计算出路径最短的车辆id,起点液压台终点缓存区库位点
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), location.getCode());
//占用车辆
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
}else {
return R.failed("暂无可用车辆!请稍后重试!");
}
//更改任务为入缓存区
currTask.setIsCache(1);
currTask.setCacheSatatus(1);
currTask.setUpdateTime(LocalDateTime.now());
currTask.setLocationId(location.getId());
currTaskServiceBiz.updateById(currTask);
//异步调用车辆
asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(),vehicleInfoList.get(0).getId());
return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。");
asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(),vehicleId);
return R.ok("操作成功!当前目标窑炉已满,托盘准备加入缓存区待加工队列。");
}
return R.failed("当前目标窑炉已满!缓存区已满!请稍后重试!");
}
@ -106,7 +160,93 @@ public class RunTaskUtils {
* 呼叫车辆暂存缓存区车辆调度任务结束后结束后再查询缓存区队列避免车辆路线冲突查询该窑炉的缓存区队列开始下一托盘货物调度进窑炉
* @return
*/
public R runTaskForOutKiln(){
return null;
public R runTaskForOutKiln(Long kilnId){
//查询正在该窑炉加工的currTask
CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>()
.eq("is_in", 1)
.eq("status", 1)
.eq("kiln_id", kilnId));
//查询是否为自动任务
if (currTask.getIsAuto()==1) {
//查询自动任务的哪一步的设备id是该窑炉
int firstCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
if (firstCount == 1) {
//当前为自动任务第一步
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
//第二部的currTaskId
Long taskId = autoExeTask.getTTaskId();
CurrTask currTaskTwo = currTaskServiceBiz.getById(taskId);
try {
runTaskForInKiln(taskId);
logger.info("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
// TODO: 2022/2/27 websocket推送到页面显示
return R.ok("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
//当前加工步骤不为第一步
int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId()));
if (secondCount == 2) {
//当前为自动任务第二步
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId()));
//该自动任务的工艺类型为2还有第三步
if (autoExeTask.getProcessFlowType()==2){
Long thTaskId = autoExeTask.getThTaskId();
CurrTask currTaskThree = currTaskServiceBiz.getById(thTaskId);
try {
runTaskForInKiln(thTaskId);
logger.info("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskThree);
// TODO: 2022/2/27 websocket推送到页面显示
return R.ok("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskThree);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
//查询缓存区库位是否已满
int count = locationServiceBiz.count(new QueryWrapper<Location>()
.eq(Location.STATUS, 0)
.eq(Location.VALID, 1));
//缓存区未满
if (count >0) {
List<Location> locationList = locationServiceBiz.list(new QueryWrapper<Location>()
.eq(Location.STATUS, 0)
.eq(Location.VALID, 1));
//是否有小车在运行
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
if (vehicleInfoList.size()>0){
//有小车在运行提示当前有车辆在运行请稍后
return R.failed("当前轨道有RGV车辆在运动请等待当前RGV车辆执行完毕再执行任务");
}
//计算出路径最短的车辆id
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
//窑炉为起点
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, kilnInfo.getCode())).getCode();
//缓存区为终点
Location location = locationList.get(0);
Long targetPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode())).getCode();
Long vehicleId = taskDistanceUtils.chooseVehicle(kilnInfo.getCode(), location.getCode());
//占用车辆
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
//修改任务状态
currTask.setIsOut(0);
currTask.setTaskType(2);
currTask.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
// TODO: 2022/2/16 异步调用车辆
asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(),vehicleInfoList.get(0).getId());
return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。");
}else {
return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。");
}
}
}

View File

@ -1,19 +1,455 @@
package com.mt.wms.empty.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.utils.CodeGeneratorHelper;
import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.vo.R;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author: liguanghao
* @Date: 2021/12/13 19:54
* @Version 1.0
*/
public class ScheduledTask {
public class ScheduledTask extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(AsynRunTaskService.class);
@Resource
private KilnInfoServiceBiz kilnInfoServiceBiz;
@Resource
private VehicleInfoServiceBiz vehicleInfoServiceBiz;
@Resource
private InStockInfoServiceBiz inStockInfoServiceBiz;
@Resource
private TaskDistanceUtils taskDistanceUtils;
@Resource
private LocationServiceBiz locationServiceBiz;
@Resource
private CurrTaskServiceBiz currTaskServiceBiz;
@Resource
private AsynRunTaskService asynRunTaskService;
@Resource
private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz;
@Resource
private AlarmInfoServiceBiz alarmInfoServiceBiz;
@Resource
private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
@Resource
private ParGasValueServiceBiz parGasValueServiceBiz;
@Resource
private ParTemValueServiceBiz parTemValueServiceBiz;
@Resource
private ParEleValueServiceBiz parEleValueServiceBiz;
@Resource
private PointInfoServiceBiz pointInfoServiceBiz;
@Resource
private RunTaskUtils runTaskUtils;
/**
* 查询加工完成的窑炉
*/
@Scheduled
public void taskForStockToKiln(){
//遍历窑炉状态若加工完毕查询空车占用异步处理继续遍历下一个窑炉状态
//两辆车是否都空闲只有两辆车都空闲才被允许做任务
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));
if (vehicleInfoList.size()==2){
//遍历currTask为进行中且is_in为正在加工的窑炉状态若加工完毕调用runTaskForOutKiln
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
.eq(CurrTask.STATUS, 1)
.eq(CurrTask.IS_IN, 1));
for (CurrTask currTask :currTaskList
) {
Long kilnId = currTask.getKilnId();
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
PlcNameSpace plcNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 1)
.eq(PlcNameSpace.TYPE, 0)
.eq(PlcNameSpace.EQ_ID,kilnId));
//通过允许出炉信号来判定是否加工完成
String result = readPlcToString(plcNameSpace.getName(), "AllowOut");
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (resultBoolean){
//调用RunTaskUtils.runTaskForOutKiln
runTaskUtils.runTaskForOutKiln(kilnId);
break;
}
}
}
}
//查询出正在加工的窑炉遍历根据采集频率的不同采集高频数据能源消耗
public void getFastValue(){
//加工炉列表
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE,1,3));
for (KilnInfo kilnInfo:kilnInfoList
) {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 1)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())
.eq(PlcNameSpace.TYPE,1));
String nameSpaceNote = nameSpace.getName();
String result = readPlcToString(nameSpaceNote, "Working");
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
//该炉子在工作中
if (resultBoolean){
Long kilnId = kilnInfo.getId();
String identificationNumber = readPlcToString(nameSpaceNote, "Identification number");
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
//加工炉
if (kilnInfo.getType()==1){
//一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
//二号油搅拌转速
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue();
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
parRotSpeedValue.setKilnId(kilnId);
parRotSpeedValue.setTaskId(currTaskId);
setCommonField(parRotSpeedValue);
parRotSpeedValueServiceBiz.save(parRotSpeedValue);
//氮气
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
//甲烷
Double methanolFlow = readPlc(nameSpaceNote, "MethanolFlow");
//丙烷
Double propaneFlow = readPlc(nameSpaceNote, "PropaneFlow");
//氨气
Double ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow");
//实际碳势
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定碳势
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
ParGasValue parGasValue=new ParGasValue();
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue.setMethanolFlow(methanolFlow.floatValue());
parGasValue.setPropaneFlow(propaneFlow.floatValue());
parGasValue.setActualNitPotValue(actualCarbon.floatValue());
parGasValue.setSetNitPotValue(setupCarbon.floatValue());
parGasValue.setKilnId(kilnId);
parGasValue.setTaskId(currTaskId);
setCommonField(parGasValue);
parGasValueServiceBiz.save(parGasValue);
}
//氮化炉
if (kilnInfo.getType()==3){
//实际氮势
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定氮势
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
//氢含量
Double hydrogenContent = readPlc(nameSpaceNote, "HydrogenContent");
//分解率
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
//氨气量
Double ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow");
//氮气量
Double nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow");
//二氧化碳量
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CarbonDioxideFlow");
ParGasValue parGasValue3=new ParGasValue();
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
parGasValue3.setSetNitPotValue(setupCarbon.floatValue());
parGasValue3.setHydrogenContent(hydrogenContent.floatValue());
parGasValue3.setDecompositionRate(decompositionRate.floatValue());
parGasValue3.setKilnId(kilnId);
parGasValue3.setTaskId(currTaskId);
setCommonField(parGasValue3);
parGasValueServiceBiz.save(parGasValue3);
}
}
}
}
//查询出正在加工的窑炉遍历根据采集频率的不同采集低频数据能源消耗
public void getSlowValue(){
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
for (KilnInfo kilnInfo:kilnInfoList
) {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 1)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())
.eq(PlcNameSpace.TYPE,1));
String nameSpaceNote = nameSpace.getName();
String result = readPlcToString(nameSpaceNote, "Working");
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (resultBoolean){
Long kilnId = kilnInfo.getId();
String identificationNumber = readPlcToString(nameSpaceNote, "Identification number");
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
//加工炉
if (kilnInfo.getType()==1){
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
//油槽实际温度
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
//油槽设定温度
Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp");
ParTemValue parTemValue=new ParTemValue();
parTemValue.setSetTemValue(setUpTemp.floatValue());
parTemValue.setActTemValue(actualTemp.floatValue());
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
parTemValue.setKilnId(kilnId);
parTemValue.setTaskId(currTaskId);
setCommonField(parTemValue);
parTemValueServiceBiz.save(parTemValue);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue=new ParEleValue();
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue.setTotalBat(electricalValue.floatValue());
parEleValue.setKilnId(kilnId);
parEleValue.setTaskId(currTaskId);
setCommonField(parEleValue);
parEleValueServiceBiz.save(parEleValue);
}
//回火炉
if (kilnInfo.getType()==2){
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
ParTemValue parTemValue2=new ParTemValue();
parTemValue2.setSetTemValue(setUpTemp.floatValue());
parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId);
parTemValue2.setTaskId(currTaskId);
setCommonField(parTemValue2);
parTemValueServiceBiz.save(parTemValue2);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue2=new ParEleValue();
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue2.setTotalBat(electricalValue.floatValue());
parEleValue2.setKilnId(kilnId);
parEleValue2.setTaskId(currTaskId);
setCommonField(parEleValue2);
parEleValueServiceBiz.save(parEleValue2);
}
//氮化炉
if (kilnInfo.getType()==3){
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
//炉压
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
//外一区温度
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
//外二区温度
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
ParTemValue parTemValue3=new ParTemValue();
parTemValue3.setSetTemValue(setUpTemp.floatValue());
parTemValue3.setActTemValue(actualTemp.floatValue());
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
parTemValue3.setOuterZone2Temp(outerZone2Temperature.floatValue());
parTemValue3.setFurnacePressure(furnacePressure.floatValue());
parTemValue3.setKilnId(kilnId);
parTemValue3.setTaskId(currTaskId);
setCommonField(parTemValue3);
parTemValueServiceBiz.save(parTemValue3);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue3=new ParEleValue();
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue3.setTotalBat(electricalValue.floatValue());
parEleValue3.setKilnId(kilnId);
parEleValue3.setTaskId(currTaskId);
setCommonField(parEleValue3);
parEleValueServiceBiz.save(parEleValue3);
}
//清洗炉
if (kilnInfo.getType()==4){
//电度值
Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue4=new ParEleValue();
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
parEleValue4.setTotalBat(electricalValue.floatValue());
parEleValue4.setKilnId(kilnId);
parEleValue4.setTaskId(currTaskId);
setCommonField(parEleValue4);
parEleValueServiceBiz.save(parEleValue4);
}
}
}
}
//遍历窑炉空窑炉查询缓存区是否有等待加工的任务
//待加工任务存在且没有状态为正在进炉的情况下按照先进先出的规则选择待加工任务呼叫车辆进炉
public void runTaskForEmptyKiln(){
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
.eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0));
//存在空闲窑炉
if (kilnInfoList.size()!=0){
//缓存去是否有目标位置为窑炉的待加工任务
KilnInfo kilnInfo = kilnInfoList.get(0);
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
.eq(InStockInfo.TYPE, 1)
.eq(InStockInfo.KILN_ID, kilnInfo.getId())
.orderByAsc(InStockInfo.IN_TIME));
if (inStockInfoList.size()>0){
InStockInfo inStockInfo = inStockInfoList.get(0);
CurrTask currTask = currTaskServiceBiz.getById(inStockInfo.getTaskId());
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
//是否有小车在运行
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
//两辆车同时空闲其中一辆车在运行时不能调度另一辆车防止运行中路线冲突
if (vehicleInfoList.size()==0){
//计算出路径最短的车辆id
Long vehicleId = taskDistanceUtils.chooseVehicle(location.getCode(), kilnInfo.getCode());
//占用车辆
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
asynRunTaskService.asynRunTaskForStockToKiln(inStockInfo.getId(),vehicleId);
}
}
}
}
//遍历正在工作炉子的报警变量记录报警
public void listenKilnAlarm(){
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
for (KilnInfo kilnInfo:kilnInfoList
) {
// TODO: 2022/2/28 判断炉子是否在工作状态
if (true){
PlcNameSpace kilnNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId()));
//命名空间前缀
String nameSpace = kilnNameSpace.getNote();
//炉子的报警变量
List<PlcNameSpace> alarmNameList = plcNameSpaceServiceBiz.list(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 1)
.eq(PlcNameSpace.TYPE, 1)
.eq(PlcNameSpace.EQ_ID,kilnInfo.getId()));;
for (PlcNameSpace plcNameSpace:alarmNameList
) {
String name = plcNameSpace.getName();
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",nameSpace.concat(name));
String jsonString = JSON.toJSONString(json);
try {
String result = HttpClient.httpPost("http://localhost:8009/opcua/read", jsonString);
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
//报警状态为true
if (resultBoolean){
//任务状态为执行中且正在炉子中加工的任务
CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>()
.eq(CurrTask.KILN_ID, kilnInfo.getId())
.eq(CurrTask.IS_IN, 1)
.eq(CurrTask.STATUS, 1));
AlarmInfo alarmInfo=new AlarmInfo();
alarmInfo.setEquipmentId(currTask.getKilnId());
alarmInfo.setEquipmentName(currTask.getKilnName());
alarmInfo.setType(0);
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
alarmInfo.setAlarmInfo(plcNameSpace.getNote());
alarmInfo.setTaskCode(currTask.getTaskCode());
alarmInfo.setCreateTime(LocalDateTime.now());
alarmInfoServiceBiz.save(alarmInfo);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
/**
* 获取变量值
* @param nameSpace nameSpace前缀
* @param variableName 变量名称
* @return result字符串
*/
private String readPlcToString(String nameSpace, String variableName){
String identifier=nameSpace.concat(variableName);
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
String result = null;
try {
result = HttpClient.httpPost("http://localhost:8009/opcua/read", JSON.toJSONString(json));
} catch (IOException e) {
e.printStackTrace();
logger.info("readPLC "+identifier+" 的值失败");
}
return result;
}
/**
* 获取变量值
* @param nameSpace nameSpace前缀
* @param variableName 变量名称
* @return 变量值
*/
private Double readPlc(String nameSpace, String variableName){
String identifier=nameSpace.concat(variableName);
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
String result = null;
try {
result = HttpClient.httpPost("http://localhost:8009/opcua/read", JSON.toJSONString(json));
} catch (IOException e) {
e.printStackTrace();
logger.info("能源消耗统计:获取 "+identifier+" 的值失败");
}
return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
}
}

View File

@ -1,5 +1,12 @@
package com.mt.wms.empty.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.dal.entity.PointInfo;
import com.mt.wms.core.dal.service.PointInfoServiceBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.List;
/**
@ -7,27 +14,85 @@ import java.util.List;
* @Date: 2021/12/1 16:56
* @Version 1.0
*/
@Component
public class TaskDistanceUtils {
@Autowired
private PointInfoServiceBiz pointInfoServiceBiz;
/**
* 计算各个空闲小车执行此任务的路径长度传入任务起终点返回一个小车ID
* @param startPoint 起点
* @param endPoint 终点
* @return 路径最短的小车id
*/
public static Long chooseVehicle(String startPoint,String endPoint){
public Long chooseVehicle(String startPoint,String endPoint){
Integer start = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, startPoint)).getId();
Integer end = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, endPoint)).getId();
//获取点位list
List<PointInfo> pointInfoList = pointInfoServiceBiz.list(new QueryWrapper<PointInfo>().orderByAsc(PointInfo.ID));
//计算任务起点到终点的距离
List<PointInfo> pointInfoListForTask = pointInfoList.subList(start - 1, end - 1);
Double taskDistance=0D;
for (PointInfo pointInfo:pointInfoListForTask
) {
taskDistance=taskDistance+pointInfo.getDistance();
}
//计算空闲小车当前位置到起点的距离
// TODO: 2022/2/19 两辆小车都空闲获取出当前位置
Integer vehicle1=0;
Integer vehicle2=39;
List<PointInfo> pointInfoListForVehicle1 = pointInfoList.subList((vehicle1<start)?vehicle1:start - 1, (end>vehicle1)?end:vehicle1 - 1);
List<PointInfo> pointInfoListForVehicle2 = pointInfoList.subList((vehicle2<start)?vehicle2:start - 1, (end>vehicle2)?end:vehicle2 - 1);
//计算得出总距离最短的小车
return null;
Double vehicle1Distance=0D;
for (PointInfo pointInfo:pointInfoListForVehicle1
) {
vehicle1Distance=vehicle1Distance+pointInfo.getDistance();
}
Double vehicle2Distance=0D;
for (PointInfo pointInfo:pointInfoListForVehicle2
) {
vehicle2Distance=vehicle2Distance+pointInfo.getDistance();
}
return (vehicle1Distance< vehicle2Distance)?1L:2L;
}
/**
* 计算正在执行任务的小车本次任务的剩余路径经过的点位集合
* 计算执行任务的小车本次任务的剩余路径经过的点位集合
* @param vehicle 小车id
* @param startPoint 起点
* @param endPoint 终点
* @return 点位集合
*/
public static List getPointList(){
//获取小车当前位置
public List getPointList(Long vehicle,String startPoint,String endPoint){
Integer start = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, startPoint)).getId();
Integer end = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, endPoint)).getId();
//获取点位list
List<PointInfo> pointInfoList = pointInfoServiceBiz.list(new QueryWrapper<PointInfo>().orderByAsc(PointInfo.ID));
// TODO: 2022/2/19 获取小车当前位置
Integer nowPoint=3;
//计算小车当前位置到任务起点-任务起点到任务终点的路径点集合
//小车当前位置起点终点找出最大最小值
int min=(((nowPoint<start)?nowPoint:start)<end)?((nowPoint<start)?nowPoint:start):end;
int max=(((nowPoint>start)?nowPoint:start)>end)?((nowPoint>start)?nowPoint:start):end;
return pointInfoList.subList(min, max);
}
return null;
//判断小车是否冲突,传入选定小车的id,任务起终点,另一小车位置
public Boolean conflictForVehicle(Long vehicle,String startPoint,String endPoint,Integer otherNowPoint){
Integer start = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, startPoint)).getId();
Integer end = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.CODE, endPoint)).getId();
//获取点位list
List<PointInfo> pointInfoList = pointInfoServiceBiz.list(new QueryWrapper<PointInfo>().orderByAsc(PointInfo.ID));
// TODO: 2022/2/19 获取小车当前位置
Integer nowPoint=3;
//计算小车当前位置到任务起点-任务起点到任务终点的路径点集合
//小车当前位置起点终点找出最大最小值
int min=(((nowPoint<start)?nowPoint:start)<end)?((nowPoint<start)?nowPoint:start):end;
int max=(((nowPoint>start)?nowPoint:start)>end)?((nowPoint>start)?nowPoint:start):end;
if (otherNowPoint>=min&&otherNowPoint<=max){
return true;
}else {
return false;
}
}
}

View File

@ -1,14 +1,17 @@
package com.mt.wms.empty.task;
import com.mt.wms.core.dal.service.PointInfoServiceBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @Author: liguanghao
* @Date: 2021/12/1 16:38
* @Version 1.0
*/
//计算车辆路径是否冲突的方法若只有一辆车空闲计算是否冲突
// 若两辆车都空闲且路径冲突离起点近的那辆车计算避让出起点的距离离终点近的那辆车计算出避让出终点的距离取小
@Component
public class VehicleCollisionUtils {
//获取当前车辆执行任务的路径与其他正在执行任务的车辆路径对比
//根据点坐标的最大最小值确定任务需要经过的点的集合再根据车辆自身大小加上安全距离包含的点位
//比较两个集合是否有相同元素
}

View File

@ -39,6 +39,11 @@ public class AlarmInfoVo extends BaseVo implements PageVo.ConvertVo{
*/
@ApiModelProperty(value = "设备名称",example = "0")
private String equipmentName;
/**
* currtask任务code
*/
@ApiModelProperty(value = "currtask任务code",example = "0")
private String taskCode;
/**
* 报警类型
*/

View File

@ -0,0 +1,236 @@
package com.mt.wms.empty.vo;
import com.mt.wms.core.base.BaseVo;
import com.mt.wms.core.vo.PageVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* @Author: liguanghao
* @Date: 2022/3/3 22:56
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "自动任务视图对象", description = "用于查询自动任务信息")
public class AutoTaskVo extends BaseVo implements PageVo.ConvertVo{
/**
* 主键自增
*/
@ApiModelProperty(value = "主键", example = "1")
private Long id;
/**
* 添加时间
*/
@ApiModelProperty(value = "添加时间", example = "0")
private LocalDateTime createTime;
/**
* 编码
*/
@ApiModelProperty(value = "编码",example = "0")
private String interCode;
/**
* 工艺类型1表示第一种工艺流程2表示第二种工艺流程
*/
@ApiModelProperty(value = "工艺类型1表示第一种工艺流程2表示第二种工艺流程",example = "0")
private Integer processFlowType;
/**
* 状态0新增1执行中2完成
*/
@ApiModelProperty(value = "状态0新增1执行中2完成",example = "0")
private Integer status;
/**
* 执行任务ID关联任务表t_curr_task
*/
@ApiModelProperty(value = "执行任务ID关联任务表t_curr_task",example = "0")
private Long fTaskId;
/**
* 任务编码,子任务编码对应任务表t_curr_task中task_code编码
*/
@ApiModelProperty(value = "任务编码,子任务编码对应任务表t_curr_task中task_code编码",example = "0")
private String fDetTaskCode;
/**
* 设备类型ID关联设备类型表t_equipment_type
*/
@ApiModelProperty(value = "设备类型ID关联设备类型表t_equipment_type",example = "0")
private Long fEquipmentTypeId;
/**
* 设备ID关联设备表t_kiln_info
*/
@ApiModelProperty(value = "设备ID关联设备表t_kiln_info",example = "0")
private Long fEquipmentId;
/**
* 设备名称炉子名称
*/
@ApiModelProperty(value = "设备名称(炉子名称)",example = "0")
private String fEquipmentName;
/**
* 工艺号ID关联工艺号表t_craft_info
*/
@ApiModelProperty(value = "工艺号ID关联工艺号表t_craft_info",example = "0")
private Long fCraftCodeId;
/**
* 工艺号对应PLC值
*/
@ApiModelProperty(value = "工艺号对应PLC值",example = "0")
private Integer fPlcValue;
/**
* 进炉运输状态0开始1运输中2运输完成
*/
@ApiModelProperty(value = "进炉运输状态0开始1运输中2运输完成",example = "0")
private Integer fInTranStatus;
/**
* 加工状态0加工开始1加工中2加工完成
*/
@ApiModelProperty(value = "加工状态0加工开始1加工中2加工完成",example = "0")
private Integer fProStatus;
/**
* 出炉运输状态0开始1运输中2运输完成
*/
@ApiModelProperty(value = "出炉运输状态0开始1运输中2运输完成",example = "0")
private Integer fOutTranStatus;
/**
* 执行任务ID关联任务表t_curr_task
*/
@ApiModelProperty(value = "执行任务ID关联任务表t_curr_task",example = "0")
private Long tTaskId;
/**
* 任务编码,子任务编码对应任务表t_curr_task中task_code编码
*/
@ApiModelProperty(value = "任务编码,子任务编码对应任务表t_curr_task中task_code编码",example = "0")
private String tDetTaskCode;
/**
* 设备类型ID关联设备类型表t_equipment_type
*/
@ApiModelProperty(value = "设备类型ID关联设备类型表t_equipment_type",example = "0")
private Long tEquipmentTypeId;
/**
* 设备名称
*/
@ApiModelProperty(value = "设备名称",example = "0")
private String tEquipmentName;
/**
* 设备ID关联设备表t_kiln_info
*/
@ApiModelProperty(value = "设备ID关联设备表t_kiln_info",example = "0")
private Long tEquipmentId;
/**
* 工艺号ID关联工艺号表t_craft_info
*/
@ApiModelProperty(value = "工艺号ID关联工艺号表t_craft_info",example = "0")
private Long tCraftCodeId;
/**
* 工艺号对应PLC值
*/
@ApiModelProperty(value = "工艺号对应PLC值",example = "0")
private Integer tPlcValue;
/**
* 进炉运输状态0开始1运输中2运输完成
*/
@ApiModelProperty(value = "进炉运输状态0开始1运输中2运输完成",example = "0")
private Integer tInTranStatus;
/**
* 加工状态0加工开始1加工中2加工完成
*/
@ApiModelProperty(value = "加工状态0加工开始1加工中2加工完成",example = "0")
private Integer tProStatus;
/**
* 出炉运输状态0开始1运输中2运输完成
*/
@ApiModelProperty(value = "出炉运输状态0开始1运输中2运输完成",example = "0")
private Integer tOutTranStatus;
/**
* 执行任务ID关联任务表t_curr_task
*/
@ApiModelProperty(value = "执行任务ID关联任务表t_curr_task",example = "0")
private Long thTaskId;
/**
* 任务编码,子任务编码对应任务表t_curr_task中task_code编码
*/
@ApiModelProperty(value = "任务编码,子任务编码对应任务表t_curr_task中task_code编码",example = "0")
private String thDetTaskCode;
/**
* 设备类型ID关联设备类型表t_equipment_type
*/
@ApiModelProperty(value = "设备类型ID关联设备类型表t_equipment_type",example = "0")
private Long thEquipmentTypeId;
/**
* 设备名称
*/
@ApiModelProperty(value = "设备名称",example = "0")
private String thEquipmentName;
/**
* 设备ID关联设备表t_kiln_info
*/
@ApiModelProperty(value = "设备ID关联设备表t_kiln_info",example = "0")
private Long thEquipmentId;
/**
* 工艺号ID关联工艺号表t_craft_info
*/
@ApiModelProperty(value = "工艺号ID关联工艺号表t_craft_info",example = "0")
private Long thCraftCodeId;
/**
* 工艺号对应PLC值
*/
@ApiModelProperty(value = "工艺号对应PLC值",example = "0")
private Integer thPlcValue;
/**
* 进炉运输状态0开始1运输中2运输完成
*/
@ApiModelProperty(value = "进炉运输状态0开始1运输中2运输完成",example = "0")
private Integer thInTranStatus;
/**
* 加工状态0加工开始1加工中2加工完成
*/
@ApiModelProperty(value = "加工状态0加工开始1加工中2加工完成",example = "0")
private Integer thProStatus;
/**
* 出炉运输状态0开始1运输中2运输完成
*/
@ApiModelProperty(value = "出炉运输状态0开始1运输中2运输完成",example = "0")
private Integer thOutTranStatus;
/**
* 备注
*/
@ApiModelProperty(value = "备注",example = "0")
private String content;
}

View File

@ -0,0 +1,46 @@
package com.mt.wms.empty.vo;
import com.mt.wms.core.base.BaseVo;
import com.mt.wms.core.vo.PageVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* @Author: liguanghao
* @Date: 2022/3/4 10:47
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "消耗数据视图对象", description = "用于查询消耗数据")
public class ConsumeDataVo extends BaseVo implements PageVo.ConvertVo{
/**
* 时间
*/
@ApiModelProperty(value = "时间", example = "0")
private LocalDateTime createTime;
/**
* 消耗值
*/
@ApiModelProperty(value = "消耗值",example = "0.0")
private Float value;
/**
* 单位
*/
@ApiModelProperty(value = "单位",example = "0.0")
private String unit;
/**
* 名称
*/
@ApiModelProperty(value = "名称",example = "0.0")
private String name;
}

View File

@ -36,12 +36,12 @@ public class StockInfoVo extends BaseVo implements PageVo.ConvertVo{
* 库位id
*/
@ApiModelProperty(value = "库位id",example = "0")
private Long localtionId;
private Long locationId;
/**
* 库位名称
*/
@ApiModelProperty(value = "库位名称",example = "0")
private String localtionName;
private String locationName;
/**
* 任务id
*/

View File

@ -60,6 +60,11 @@
<artifactId>knife4j-spring-ui</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
</dependencies>
<build>