lgh
This commit is contained in:
parent
10821861aa
commit
b2f279d9a6
@ -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"));
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-14
|
||||
* @since 2022-03-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ -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";
|
||||
|
@ -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地址
|
||||
|
@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-27
|
||||
* @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,7 +110,7 @@ public class ParEleValue extends Model<ParEleValue> {
|
||||
private Float totalBat;
|
||||
|
||||
/**
|
||||
* 时间段类型。0:半小时,1:天,2:月
|
||||
* 时间段类型。0:半小时,1:天,2:月
|
||||
*/
|
||||
@TableField("date_type")
|
||||
private Integer dateType;
|
||||
@ -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";
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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> {
|
||||
|
||||
|
@ -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>
|
||||
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-14
|
||||
* @since 2022-03-03
|
||||
*/
|
||||
public interface AutoExeTaskMapper extends BaseMapper<AutoExeTask> {
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-27
|
||||
* @since 2022-03-01
|
||||
*/
|
||||
public interface ParEleValueMapper extends BaseMapper<ParEleValue> {
|
||||
|
||||
|
@ -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" />
|
||||
@ -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, date_type, 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>
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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> {
|
||||
|
||||
}
|
@ -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>
|
@ -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> {
|
||||
|
||||
}
|
@ -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>
|
@ -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> {
|
||||
|
||||
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-14
|
||||
* @since 2022-03-03
|
||||
*/
|
||||
public interface AutoExeTaskServiceBiz extends IService<AutoExeTask> {
|
||||
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-27
|
||||
* @since 2022-03-01
|
||||
*/
|
||||
public interface ParEleValueServiceBiz extends IService<ParEleValue> {
|
||||
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -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> {
|
||||
|
||||
|
@ -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> {
|
||||
|
||||
}
|
@ -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> {
|
||||
|
||||
}
|
@ -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 {
|
||||
|
@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-14
|
||||
* @since 2022-03-03
|
||||
*/
|
||||
@Service
|
||||
public class AutoExeTaskServiceBizImpl extends ServiceImpl<AutoExeTaskMapper, AutoExeTask> implements AutoExeTaskServiceBiz {
|
||||
|
@ -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 {
|
||||
|
@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2021-12-27
|
||||
* @since 2022-03-01
|
||||
*/
|
||||
@Service
|
||||
public class ParEleValueServiceBizImpl extends ServiceImpl<ParEleValueMapper, ParEleValue> implements ParEleValueServiceBiz {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -0,0 +1,54 @@
|
||||
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);
|
||||
}
|
||||
|
||||
private R<IdVo> stop(@Validated @RequestBody IdParam idParam){
|
||||
return autoTaskService.stop(idParam);
|
||||
}
|
||||
}
|
@ -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.getDetParams();
|
||||
//自动任务循环添加多条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);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,13 @@ 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.entity.ParGasValue;
|
||||
import com.mt.wms.core.dal.entity.ParRotSpeedValue;
|
||||
import com.mt.wms.core.dal.entity.ParTemValue;
|
||||
import com.mt.wms.core.dal.service.ParEleValueServiceBiz;
|
||||
import com.mt.wms.core.dal.service.ParGasValueServiceBiz;
|
||||
import com.mt.wms.core.dal.service.ParRotSpeedValueServiceBiz;
|
||||
import com.mt.wms.core.dal.service.ParTemValueServiceBiz;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.ElectricQueryParam;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -41,7 +47,7 @@ import java.util.Map;
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "electric")
|
||||
@Slf4j
|
||||
@Api(value = "电能消耗相关接口", tags = "电能消耗相关接口", hidden = false)
|
||||
public class ElectricController extends BaseController {
|
||||
public class EnergyController extends BaseController {
|
||||
|
||||
|
||||
//@PostConstruct
|
||||
@ -56,7 +62,7 @@ public class ElectricController extends BaseController {
|
||||
ParEleValue parEleValue=new ParEleValue();
|
||||
parEleValue.setDateType(2);
|
||||
parEleValue.setParId(1);
|
||||
parEleValue.setKilnId(1);
|
||||
parEleValue.setKilnId(1L);
|
||||
parEleValue.setTotalBat(Float.valueOf(String.valueOf(f+(Math.random()*24000))));
|
||||
parEleValue.setCreateTime(timeEnd);
|
||||
timeEnd=timeEnd.plus(1,ChronoUnit.MONTHS);
|
||||
@ -67,16 +73,18 @@ public class ElectricController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
public void test1(){
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ParEleValueServiceBiz parEleValueServiceBiz;
|
||||
@Autowired
|
||||
private ParGasValueServiceBiz parGasValueServiceBiz;
|
||||
@Autowired
|
||||
private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
|
||||
@Autowired
|
||||
private ParTemValueServiceBiz parTemValueServiceBiz;
|
||||
|
||||
@PostMapping(value = "eletric")
|
||||
@ApiOperation(value = "根据窑炉id获取电能消耗情况")
|
||||
private R<String> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
|
||||
@ApiOperation(value = "根据窑炉id获取消耗情况")
|
||||
public R<String> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
|
||||
Long kiln = electricQueryParam.getKilnId();
|
||||
//窑炉id为0代表全部,存储的时候计算全部
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
@ -206,4 +214,32 @@ public class ElectricController extends BaseController {
|
||||
}
|
||||
return successful(jsonObject.toJSONString());
|
||||
}
|
||||
@PostMapping(value = "energyList")
|
||||
@ApiOperation(value = "根据加工炉id获取能源消耗情况")
|
||||
public R<String> energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam){
|
||||
//传入任务号,窑炉号,查询消耗数据,返回json字符串
|
||||
//电能消耗
|
||||
List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
//氮气、甲醇、丙烷、氨气消耗量
|
||||
List<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>()
|
||||
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
//油搅拌转速趋势
|
||||
List<ParRotSpeedValue> parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper<ParRotSpeedValue>()
|
||||
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
//温度趋势(实际温度、设定温度)
|
||||
List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>()
|
||||
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("ele",parEleValueList);
|
||||
jsonObject.put("gas",parGasValueList);
|
||||
jsonObject.put("rot",parRotSpeedValueList);
|
||||
jsonObject.put("tem",parTemValueList);
|
||||
return R.ok(jsonObject.toJSONString());
|
||||
}
|
||||
|
||||
}
|
@ -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> detParams;
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -25,6 +25,9 @@ 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)
|
||||
private LocalDateTime time;
|
||||
|
@ -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;
|
||||
}
|
@ -24,8 +24,12 @@ public class TaskCreateParam extends BaseParam {
|
||||
|
||||
// @ApiModelProperty(value = "托盘号")
|
||||
// private String palletCode;
|
||||
@ApiModelProperty(value = "起点(提升平台)", required = true)
|
||||
private String startPosition;
|
||||
@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)
|
||||
private String targetPosition;
|
||||
@ApiModelProperty(value = "加工类型:0 初始加工,1 复加工", required = true)
|
||||
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +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
|
||||
@ -35,10 +44,73 @@ public class AsynRunTaskService extends BaseService {
|
||||
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());
|
||||
@ -50,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());
|
||||
@ -63,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,13 +265,9 @@ public class AsynRunTaskService extends BaseService {
|
||||
runTask.setVehicleId(vehicleId);
|
||||
runTask.setBeginTime(LocalDateTime.now());
|
||||
runTask.setStartPosition(currTask.getStartPosition());
|
||||
// TODO: 2021/12/28 location对应的点位
|
||||
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);
|
||||
@ -106,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){
|
||||
@ -128,11 +297,14 @@ 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推送到前端
|
||||
}
|
||||
}
|
||||
@ -140,12 +312,28 @@ public class AsynRunTaskService extends BaseService {
|
||||
@Async("asyncServiceExecutor")
|
||||
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());
|
||||
// TODO: 2021/12/28 location对应的点位
|
||||
// location对应的点位
|
||||
//String outTargetPosition = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode())).getCode();
|
||||
currTask.setOutTargetPosition(location.getCode());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||
@ -193,6 +381,9 @@ 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());
|
||||
@ -242,4 +433,409 @@ public class AsynRunTaskService extends BaseService {
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
vehicleInfo.setStatus(1);
|
||||
vehicleInfo.setUpdateTime(LocalDateTime.now());
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
}else {
|
||||
return R.failed("暂无可用车辆!请稍后重试!");
|
||||
}
|
||||
//计算出路径最短的车辆id
|
||||
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition());
|
||||
//占用车辆
|
||||
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
|
||||
vehicleInfo.setStatus(1);
|
||||
vehicleInfo.setUpdateTime(LocalDateTime.now());
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
//更改任务状态为执行中
|
||||
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);
|
||||
vehicleInfo.setStatus(1);
|
||||
vehicleInfo.setUpdateTime(LocalDateTime.now());
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
}else {
|
||||
return R.failed("暂无可用车辆!请稍后重试!");
|
||||
}
|
||||
//分配一个缓存区库位
|
||||
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);
|
||||
//更改任务为入缓存区
|
||||
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("当前目标窑炉已满!缓存区已满!请稍后重试!");
|
||||
}
|
||||
@ -112,34 +166,87 @@ public class RunTaskUtils {
|
||||
.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<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
|
||||
.eq(VehicleInfo.STATUS, 0)
|
||||
.eq(VehicleInfo.VALID, 1));
|
||||
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){
|
||||
VehicleInfo vehicleInfo = vehicleInfoList.get(0);
|
||||
vehicleInfo.setStatus(1);
|
||||
vehicleInfo.setUpdateTime(LocalDateTime.now());
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
}else {
|
||||
return R.failed("暂无可用车辆!请稍后重试!");
|
||||
//有小车在运行,提示当前有车辆在运行,请稍后
|
||||
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("当前缓存区已满,无法从加工炉出炉到缓存区。");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,47 +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(){
|
||||
//遍历currTask为进行中且is_in为正在加工的窑炉状态,若加工完毕,调用runTaskForOutKiln
|
||||
//两辆车是否都空闲,只有两辆车都空闲才被允许做任务
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//每个小时的0分和30分执行
|
||||
@Scheduled(cron = "0 0/30 * * * ?")
|
||||
//获取全部窑炉每半小时电能消耗数据,计算,存储
|
||||
public void getAllEleValue(){
|
||||
// TODO: 2021/12/27
|
||||
// 获取每台窑炉的电度值,存入par_ele_value,dateType为0,kilnId为窑炉Id
|
||||
// 获取11台窑炉的电度值,相加,存入par_ele_value,dateType为0,kilnId为0
|
||||
|
||||
//查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//每日23:55执行
|
||||
@Scheduled(cron = "0 55 23 * * ?")
|
||||
//获取全部窑炉每天电能消耗数据,计算,存储
|
||||
public void getAllEleValueForDay(){
|
||||
// TODO: 2021/12/27
|
||||
// 获取每台窑炉的电度值,存入par_ele_value,dateType为0,kilnId为窑炉Id
|
||||
// 获取11台窑炉的电度值,相加,存入par_ele_value,dateType为0,kilnId为0
|
||||
//遍历窑炉,空窑炉查询缓存区是否有等待加工的任务,
|
||||
//待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//每月最后一日23:55执行
|
||||
@Scheduled(cron = "0 55 23 L * ?")
|
||||
//获取全部窑炉每天电能消耗数据,计算,存储
|
||||
public void getAllEleValueForMonth(){
|
||||
// TODO: 2021/12/27
|
||||
// 获取每台窑炉的电度值,存入par_ele_value,dateType为0,kilnId为窑炉Id
|
||||
// 获取11台窑炉的电度值,相加,存入par_ele_value,dateType为0,kilnId为0
|
||||
//遍历正在工作炉子的报警变量,记录报警
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
* 计算各个空闲小车执行此任务的路径长度,传入任务起终点,返回一个小车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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
//获取当前车辆执行任务的路径,与其他正在执行任务的车辆路径对比
|
||||
//根据点坐标的最大最小值确定任务需要经过的点的集合,再根据车辆自身大小加上安全距离包含的点位
|
||||
//比较两个集合是否有相同元素
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user