feat():下发钢卷设定值请求到模型程序
This commit is contained in:
@@ -17,7 +17,7 @@ import java.util.Map;
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum WsTypeEnum {
|
public enum WsTypeEnum {
|
||||||
alarm, track_position, track_measure, track_signal, track_matmap;
|
alarm, track_position, track_measure, track_signal, track_matmap,calc_setup_result;
|
||||||
|
|
||||||
private static final Map<String, WsTypeEnum> MAP = new HashMap<>(8);
|
private static final Map<String, WsTypeEnum> MAP = new HashMap<>(8);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class CrmPdiPlanController {
|
|||||||
return R.ok(crmPdiPlanService.getByCoilIdAndOperId(coilid));
|
return R.ok(crmPdiPlanService.getByCoilIdAndOperId(coilid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/getCoilInfoAndSetupList")
|
@GetMapping("/getCoilInfoAndSetupList")
|
||||||
@ApiOperation("通过钢卷号获取钢卷信息和设定值列表")
|
@ApiOperation("通过钢卷号获取钢卷信息和设定值列表")
|
||||||
public R<PdiPlanSetupInfoVO> getCoilInfoAndSetupList(@RequestParam String coilid) {
|
public R<PdiPlanSetupInfoVO> getCoilInfoAndSetupList(@RequestParam String coilid) {
|
||||||
@@ -40,12 +39,7 @@ public class CrmPdiPlanController {
|
|||||||
@ApiOperation("保存钢卷信息")
|
@ApiOperation("保存钢卷信息")
|
||||||
public R<String> editCoilInfo(@RequestBody CrmPdiPlanForm coilid) {
|
public R<String> editCoilInfo(@RequestBody CrmPdiPlanForm coilid) {
|
||||||
|
|
||||||
if (crmPdiPlanService.editCoilInfo(coilid)) {
|
return R.ok(crmPdiPlanService.editCoilInfo(coilid));
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
} else {
|
|
||||||
return R.fail("新增或更新失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +47,7 @@ public class CrmPdiPlanController {
|
|||||||
@ApiOperation("计算设定值")
|
@ApiOperation("计算设定值")
|
||||||
public R<String> editCoilInfo(@RequestBody CalcPdiPlanForm coilid) {
|
public R<String> editCoilInfo(@RequestBody CalcPdiPlanForm coilid) {
|
||||||
|
|
||||||
crmPdiPlanService.calcSetup(coilid);
|
return R.ok(crmPdiPlanService.calcSetup(coilid));
|
||||||
return R.ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package com.fizz.business.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModCoilMap {
|
||||||
|
|
||||||
|
@TableField("POSID")
|
||||||
|
private Integer posid;
|
||||||
|
|
||||||
|
@TableField("COILID")
|
||||||
|
private String coilid;
|
||||||
|
|
||||||
|
@TableField("GRADE")
|
||||||
|
private String grade;
|
||||||
|
|
||||||
|
@TableField("CLASSID")
|
||||||
|
private Integer classid;
|
||||||
|
|
||||||
|
@TableField("ENTRY_CROWN")
|
||||||
|
private Float entryCrown;
|
||||||
|
|
||||||
|
@TableField("ENTRY_THICK")
|
||||||
|
private Float entryThick;
|
||||||
|
|
||||||
|
@TableField("ENTRY_LENGTH")
|
||||||
|
private Float entryLength;
|
||||||
|
|
||||||
|
@TableField("ENTRY_DIAMETER")
|
||||||
|
private Float entryDiameter;
|
||||||
|
|
||||||
|
@TableField("ENTRY_STRESS")
|
||||||
|
private Float entryStress;
|
||||||
|
|
||||||
|
@TableField("TEMP")
|
||||||
|
private Float temp;
|
||||||
|
|
||||||
|
@TableField("WIDTH")
|
||||||
|
private Float width;
|
||||||
|
|
||||||
|
@TableField("ENTRY_WEIGHT")
|
||||||
|
private Float entryWeight;
|
||||||
|
|
||||||
|
@TableField("EXIT_THICK")
|
||||||
|
private Float exitThick;
|
||||||
|
|
||||||
|
@TableField("REDUCTION")
|
||||||
|
private Float reduction;
|
||||||
|
|
||||||
|
@TableField("EXIT_STRESS")
|
||||||
|
private Float exitStress;
|
||||||
|
|
||||||
|
@TableField("NEXT_UNIT")
|
||||||
|
private Integer nextUnit;
|
||||||
|
|
||||||
|
@TableField("STRAT_MODE")
|
||||||
|
private Integer stratMode;
|
||||||
|
|
||||||
|
@TableField("STRAT_MODE_DSC")
|
||||||
|
private String stratModeDsc;
|
||||||
|
|
||||||
|
@TableField("ROLL_MODE")
|
||||||
|
private Integer rollMode;
|
||||||
|
|
||||||
|
@TableField("ROLL_MODE_DSC")
|
||||||
|
private String rollModeDsc;
|
||||||
|
|
||||||
|
@TableField("SETUP_MODE")
|
||||||
|
private Integer setupMode;
|
||||||
|
|
||||||
|
@TableField("SETUP_MODE_DSC")
|
||||||
|
private String setupModeDsc;
|
||||||
|
|
||||||
|
@TableField("STATUS")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@TableField("STATUS_MODE_DSC")
|
||||||
|
private String statusModeDsc;
|
||||||
|
|
||||||
|
@TableField("SHIFT")
|
||||||
|
private String shift;
|
||||||
|
|
||||||
|
@TableField("CREW")
|
||||||
|
private Integer crew;
|
||||||
|
|
||||||
|
@TableField("INSDATE")
|
||||||
|
private LocalDateTime insdate;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.fizz.business.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProMatmap {
|
||||||
|
|
||||||
|
@TableField("areaid")
|
||||||
|
private Integer areaid;
|
||||||
|
|
||||||
|
@TableField("groupid")
|
||||||
|
private Integer groupid;
|
||||||
|
|
||||||
|
@TableField("pos")
|
||||||
|
private Integer pos;
|
||||||
|
|
||||||
|
@TableField("full_place_name")
|
||||||
|
private String fullPlaceName;
|
||||||
|
|
||||||
|
@TableField("matid")
|
||||||
|
private String matid;
|
||||||
|
|
||||||
|
@TableField("display_name")
|
||||||
|
private String displayName;
|
||||||
|
|
||||||
|
@TableId("l1mapidx")
|
||||||
|
private Integer l1mapidx;
|
||||||
|
|
||||||
|
@TableField("updtime")
|
||||||
|
private LocalDateTime updtime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.fizz.business.form;
|
package com.fizz.business.form;
|
||||||
|
|
||||||
|
|
||||||
import com.fizz.business.vo.ModSetupResultVO;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -28,6 +27,9 @@ public class CalcPdiPlanForm {
|
|||||||
@ApiModelProperty(value = "道次数")
|
@ApiModelProperty(value = "道次数")
|
||||||
private Integer passno;
|
private Integer passno;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "入口宽度")
|
||||||
|
private Double entryWidth;
|
||||||
|
|
||||||
@ApiModelProperty(value = "退火厚度")
|
@ApiModelProperty(value = "退火厚度")
|
||||||
private Integer annealThick;
|
private Integer annealThick;
|
||||||
|
|
||||||
@@ -38,6 +40,6 @@ public class CalcPdiPlanForm {
|
|||||||
private Double exitThick;
|
private Double exitThick;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设定值列表")
|
@ApiModelProperty(value = "设定值列表")
|
||||||
List<ModSetupResultVO> lists;
|
List<ModSetupResultCalcForm> lists;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.fizz.business.form;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModSetupResultCalcForm {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "入口厚度")
|
||||||
|
private Float entryThick;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出口厚度")
|
||||||
|
private Float exitThick;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "入口张力")
|
||||||
|
private Float entryTension;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出口张力")
|
||||||
|
private Float exitTension;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.fizz.business.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.fizz.business.domain.ModCoilMap;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ModCoilMapMapper extends BaseMapper<ModCoilMap> {
|
||||||
|
// 你可以在这里添加自定义查询方法
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.fizz.business.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.fizz.business.domain.ProMatmap;
|
||||||
|
|
||||||
|
public interface ProMatmapMapper extends BaseMapper<ProMatmap> {
|
||||||
|
|
||||||
|
int updateMatidByDisplayName(String matid);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,9 +8,12 @@ import com.google.common.collect.Lists;
|
|||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.messaging.handler.annotation.Headers;
|
||||||
|
import org.springframework.messaging.handler.annotation.Payload;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
@@ -18,13 +21,13 @@ public class RabbitQueueListener {
|
|||||||
|
|
||||||
public static List<String> measureList = Lists.newArrayList();
|
public static List<String> measureList = Lists.newArrayList();
|
||||||
private Double LastRolledLength = 0d;
|
private Double LastRolledLength = 0d;
|
||||||
@RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_MODEL)
|
// @RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_MODEL)
|
||||||
@RabbitHandler
|
// @RabbitHandler
|
||||||
public void onHmiMessage(String message) {
|
// public void onHmiMessage(String message) {
|
||||||
log.info("消费端ProcData: " + message);
|
// log.info("消费端ProcData: " + message);
|
||||||
|
//
|
||||||
//socket
|
// //socket
|
||||||
}
|
// }
|
||||||
|
|
||||||
@RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_REAL_TIME)
|
@RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_REAL_TIME)
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
@@ -44,4 +47,25 @@ public class RabbitQueueListener {
|
|||||||
//socket
|
//socket
|
||||||
WebSocketUtil.sendMessage(WsTypeEnum.track_measure,message);
|
WebSocketUtil.sendMessage(WsTypeEnum.track_measure,message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RabbitListener(queues = CommonConstants.RabbitMQ.RECEIVE_MODEL)
|
||||||
|
@RabbitHandler
|
||||||
|
public void receiveMessage(@Payload String message, @Headers Map<String, Object> headers) {
|
||||||
|
// 获取 messageId
|
||||||
|
String messageId = (String) headers.get("amqp_messageId");
|
||||||
|
|
||||||
|
// 根据 messageId 进行不同的消息处理
|
||||||
|
System.out.println("Received message with ID: " + messageId);
|
||||||
|
System.out.println("Message Content: " + message);
|
||||||
|
|
||||||
|
// 处理消息逻辑
|
||||||
|
if ("someUniqueMessageId".equals(messageId)) {
|
||||||
|
// 针对特定的消息ID进行处理
|
||||||
|
} else {
|
||||||
|
// 默认的处理逻辑
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ public interface CrmPdiPlanService extends IService<CrmPdiPlan> {
|
|||||||
|
|
||||||
void updateCrmPdiPlanById(ChangePlanStatusForm form);
|
void updateCrmPdiPlanById(ChangePlanStatusForm form);
|
||||||
|
|
||||||
boolean editCoilInfo(CrmPdiPlanForm coilid);
|
String editCoilInfo(CrmPdiPlanForm coilid);
|
||||||
|
|
||||||
void calcSetup(CalcPdiPlanForm coilid);
|
String calcSetup(CalcPdiPlanForm coilid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.fizz.business.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.fizz.business.domain.ModCoilMap;
|
||||||
|
|
||||||
|
public interface ModCoilMapService extends IService<ModCoilMap> {
|
||||||
|
void saveModCoilInfo(ModCoilMap modCoilMap);
|
||||||
|
|
||||||
|
// 你可以添加自定义的业务方法
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.fizz.business.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.fizz.business.domain.ProMatmap;
|
||||||
|
|
||||||
|
public interface ProMatmapService extends IService<ProMatmap> {
|
||||||
|
void updateMatid(String matid);
|
||||||
|
|
||||||
|
// 你可以添加自定义的业务方法
|
||||||
|
}
|
||||||
@@ -5,10 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fizz.business.domain.CrmPdiPlan;
|
import com.fizz.business.domain.CrmPdiPlan;
|
||||||
|
import com.fizz.business.domain.ModCoilMap;
|
||||||
import com.fizz.business.form.*;
|
import com.fizz.business.form.*;
|
||||||
import com.fizz.business.mapper.CrmPdiPlanMapper;
|
import com.fizz.business.mapper.CrmPdiPlanMapper;
|
||||||
import com.fizz.business.service.CrmPdiPlanService;
|
import com.fizz.business.service.CrmPdiPlanService;
|
||||||
|
import com.fizz.business.service.ModCoilMapService;
|
||||||
import com.fizz.business.service.ModSetupResultService;
|
import com.fizz.business.service.ModSetupResultService;
|
||||||
|
import com.fizz.business.service.ProMatmapService;
|
||||||
import com.fizz.business.vo.CrmPdiPlanVO;
|
import com.fizz.business.vo.CrmPdiPlanVO;
|
||||||
import com.fizz.business.vo.ModSetupResultVO;
|
import com.fizz.business.vo.ModSetupResultVO;
|
||||||
import com.fizz.business.vo.PdiPlanSetupInfoVO;
|
import com.fizz.business.vo.PdiPlanSetupInfoVO;
|
||||||
@@ -28,15 +31,22 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
@Resource
|
@Resource
|
||||||
ModSetupResultService modSetupResultService;
|
ModSetupResultService modSetupResultService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ProMatmapService proMatmapService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ModCoilMapService modCoilMapService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据卷ID和操作员ID查询单个记录
|
* 根据卷ID和操作员ID查询单个记录
|
||||||
|
*
|
||||||
* @param coilid 卷ID
|
* @param coilid 卷ID
|
||||||
* @return 查询到的CrmPdiPlan对象
|
* @return 查询到的CrmPdiPlan对象
|
||||||
*/
|
*/
|
||||||
public CrmPdiPlanVO getByCoilIdAndOperId(String coilid) {
|
public CrmPdiPlanVO getByCoilIdAndOperId(String coilid) {
|
||||||
|
|
||||||
QueryWrapper<CrmPdiPlan> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CrmPdiPlan> queryWrapper = new QueryWrapper<>();
|
||||||
if (coilid.equals("ONLINE")){
|
if (coilid.equals("ONLINE")) {
|
||||||
queryWrapper.eq("STATUS", coilid);
|
queryWrapper.eq("STATUS", coilid);
|
||||||
CrmPdiPlan one = this.getOne(queryWrapper);
|
CrmPdiPlan one = this.getOne(queryWrapper);
|
||||||
return BeanUtil.copyProperties(one, CrmPdiPlanVO.class);
|
return BeanUtil.copyProperties(one, CrmPdiPlanVO.class);
|
||||||
@@ -63,6 +73,7 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加新记录
|
* 添加新记录
|
||||||
|
*
|
||||||
* @param crmPdiPlan 要添加的CrmPdiPlan对象
|
* @param crmPdiPlan 要添加的CrmPdiPlan对象
|
||||||
* @return 是否添加成功
|
* @return 是否添加成功
|
||||||
*/
|
*/
|
||||||
@@ -72,6 +83,7 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新已有记录
|
* 更新已有记录
|
||||||
|
*
|
||||||
* @param crmPdiPlan 要更新的CrmPdiPlan对象
|
* @param crmPdiPlan 要更新的CrmPdiPlan对象
|
||||||
* @return 是否更新成功
|
* @return 是否更新成功
|
||||||
*/
|
*/
|
||||||
@@ -81,6 +93,7 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据卷ID和操作员ID删除记录
|
* 根据卷ID和操作员ID删除记录
|
||||||
|
*
|
||||||
* @param coilid 卷ID
|
* @param coilid 卷ID
|
||||||
* @return 是否删除成功
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
@@ -92,11 +105,12 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有记录
|
* 查询所有记录
|
||||||
|
*
|
||||||
* @return CrmPdiPlan对象的列表
|
* @return CrmPdiPlan对象的列表
|
||||||
*/
|
*/
|
||||||
public List<CrmPdiPlanVO> listAll(PlanQueryForm form) {
|
public List<CrmPdiPlanVO> listAll(PlanQueryForm form) {
|
||||||
QueryWrapper<CrmPdiPlan> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CrmPdiPlan> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.in("STATUS", "NEW","READY");
|
queryWrapper.in("STATUS", "NEW", "READY");
|
||||||
|
|
||||||
return BeanUtil.copyToList(this.list(), CrmPdiPlanVO.class);
|
return BeanUtil.copyToList(this.list(), CrmPdiPlanVO.class);
|
||||||
}
|
}
|
||||||
@@ -104,8 +118,8 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
@Override
|
@Override
|
||||||
public void updateCrmPdiPlanById(ChangePlanStatusForm form) {
|
public void updateCrmPdiPlanById(ChangePlanStatusForm form) {
|
||||||
|
|
||||||
if (StringUtils.compare(form.getOperation(),"ONLINE") == 0){
|
if (StringUtils.compare(form.getOperation(), "ONLINE") == 0) {
|
||||||
log.info("上线时通知通讯程序下发设定到L1,matId: {}",form.getCoilId());
|
log.info("上线时通知通讯程序下发设定到L1,matId: {}", form.getCoilId());
|
||||||
modSetupResultService.retrySetup(form.getCoilId());
|
modSetupResultService.retrySetup(form.getCoilId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,55 +129,64 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
|||||||
|
|
||||||
this.updateById(crmPdiPlan);
|
this.updateById(crmPdiPlan);
|
||||||
|
|
||||||
|
proMatmapService.updateMatid(form.getCoilId());
|
||||||
|
|
||||||
|
|
||||||
|
ModCoilMap bean = BeanUtil.toBean(crmPdiPlan, ModCoilMap.class);
|
||||||
|
modCoilMapService.saveModCoilInfo(bean);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean editCoilInfo(CrmPdiPlanForm coilid) {
|
public String editCoilInfo(CrmPdiPlanForm coilid) {
|
||||||
|
|
||||||
LambdaQueryWrapper<CrmPdiPlan> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CrmPdiPlan> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(CrmPdiPlan::getCoilid,coilid);
|
queryWrapper.eq(CrmPdiPlan::getCoilid, coilid.getCoilid());
|
||||||
|
|
||||||
CrmPdiPlan one = this.getOne(queryWrapper);
|
CrmPdiPlan one = this.baseMapper.selectOne(queryWrapper);
|
||||||
|
|
||||||
boolean flag;
|
if (one == null) {
|
||||||
if (one == null){
|
|
||||||
|
|
||||||
CrmPdiPlan bean = BeanUtil.toBean(coilid, CrmPdiPlan.class);
|
CrmPdiPlan bean = BeanUtil.toBean(coilid, CrmPdiPlan.class);
|
||||||
|
|
||||||
bean.setStatus("NEW");
|
bean.setStatus("NEW");
|
||||||
bean.setSeqid(bean.getSeqid()+ 1);
|
bean.setSeqid(bean.getSeqid() + 1);
|
||||||
|
|
||||||
flag = this.save(bean);
|
this.baseMapper.insert(bean);
|
||||||
|
|
||||||
}else {
|
|
||||||
|
} else {
|
||||||
BeanUtil.copyProperties(coilid,one);
|
|
||||||
|
BeanUtil.copyProperties(coilid, one);
|
||||||
one.setStatus("NEW");
|
one.setStatus("NEW");
|
||||||
flag = this.updateById(one);
|
|
||||||
|
this.baseMapper.updateById(one);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CalcPdiPlanForm calcPdiPlanForm = new CalcPdiPlanForm();
|
CalcPdiPlanForm calcPdiPlanForm = new CalcPdiPlanForm();
|
||||||
|
|
||||||
|
List<ModSetupResultCalcForm> calcForms = BeanUtil.copyToList(coilid.getLists(), ModSetupResultCalcForm.class);
|
||||||
|
|
||||||
calcPdiPlanForm.setGrade(coilid.getGrade());
|
calcPdiPlanForm.setGrade(coilid.getGrade());
|
||||||
calcPdiPlanForm.setOperid(coilid.getOperid());
|
calcPdiPlanForm.setOperid(coilid.getOperid());
|
||||||
calcPdiPlanForm.setAnnealThick(coilid.getAnnealThick());
|
calcPdiPlanForm.setAnnealThick(coilid.getAnnealThick());
|
||||||
|
calcPdiPlanForm.setEntryWidth(coilid.getEntryWidth());
|
||||||
calcPdiPlanForm.setExitThick(coilid.getExitThick());
|
calcPdiPlanForm.setExitThick(coilid.getExitThick());
|
||||||
calcPdiPlanForm.setPassno(coilid.getPassno());
|
calcPdiPlanForm.setPassno(coilid.getPassno());
|
||||||
calcPdiPlanForm.setEntryThick(coilid.getEntryThick());
|
calcPdiPlanForm.setEntryThick(coilid.getEntryThick());
|
||||||
calcPdiPlanForm.setOperMode(coilid.getOperMode());
|
calcPdiPlanForm.setOperMode(coilid.getOperMode());
|
||||||
calcPdiPlanForm.setLists(coilid.getLists());
|
calcPdiPlanForm.setLists(calcForms);
|
||||||
|
|
||||||
modSetupResultService.calcSetup(calcPdiPlanForm);
|
return modSetupResultService.calcSetup(calcPdiPlanForm);
|
||||||
|
|
||||||
return flag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calcSetup(CalcPdiPlanForm coilid) {
|
public String calcSetup(CalcPdiPlanForm coilid) {
|
||||||
|
|
||||||
modSetupResultService.calcSetup(coilid);
|
return modSetupResultService.calcSetup(coilid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.fizz.business.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fizz.business.domain.ModCoilMap;
|
||||||
|
import com.fizz.business.mapper.ModCoilMapMapper;
|
||||||
|
import com.fizz.business.service.ModCoilMapService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ModCoilMapServiceImpl extends ServiceImpl<ModCoilMapMapper, ModCoilMap> implements ModCoilMapService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveModCoilInfo( ModCoilMap modCoilMap){
|
||||||
|
|
||||||
|
this.baseMapper.insert(modCoilMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fizz.business.constants.CommonConstants;
|
import com.fizz.business.constants.CommonConstants;
|
||||||
|
import com.fizz.business.constants.enums.WsTypeEnum;
|
||||||
import com.fizz.business.domain.ModSetupResult;
|
import com.fizz.business.domain.ModSetupResult;
|
||||||
import com.fizz.business.form.CalcPdiPlanForm;
|
import com.fizz.business.form.CalcPdiPlanForm;
|
||||||
import com.fizz.business.form.ModSetupResultForm;
|
import com.fizz.business.form.ModSetupResultForm;
|
||||||
import com.fizz.business.mapper.ModSetupResultMapper;
|
import com.fizz.business.mapper.ModSetupResultMapper;
|
||||||
import com.fizz.business.service.ModSetupResultService;
|
import com.fizz.business.service.ModSetupResultService;
|
||||||
|
import com.fizz.business.utils.WebSocketUtil;
|
||||||
|
import com.fizz.business.vo.ModSetupResultKeyVO;
|
||||||
import com.fizz.business.vo.ModSetupResultVO;
|
import com.fizz.business.vo.ModSetupResultVO;
|
||||||
import org.springframework.amqp.core.Message;
|
import org.springframework.amqp.core.Message;
|
||||||
import org.springframework.amqp.core.MessageProperties;
|
import org.springframework.amqp.core.MessageProperties;
|
||||||
@@ -20,6 +23,8 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -32,61 +37,92 @@ public class ModSetupResultServiceImpl extends ServiceImpl<ModSetupResultMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<ModSetupResultVO> list(ModSetupResultForm form) {
|
public List<ModSetupResultVO> list(ModSetupResultForm form) {
|
||||||
|
|
||||||
// 确保各个字段的非空验证
|
// // 确保各个字段的非空验证
|
||||||
if (StringUtils.isEmpty(form.getGrade()) || form.getAnnealThick() == null ||
|
// if (StringUtils.isEmpty(form.getGrade()) || form.getAnnealThick() == null ||
|
||||||
form.getEntryThick() == null || form.getExitThick() == null || form.getPassno() == null) {
|
// form.getEntryThick() == null || form.getExitThick() == null || form.getPassno() == null) {
|
||||||
throw new IllegalArgumentException("必要的字段缺失");
|
// throw new IllegalArgumentException("必要的字段缺失");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 去除Double类型的字段的小数位
|
// // 去除Double类型的字段的小数位
|
||||||
// 获取厚度并处理
|
// // 获取厚度并处理
|
||||||
int annealThick = Math.round(form.getAnnealThick() * 100); // 乘以100并四舍五入
|
// int annealThick = Math.round(form.getAnnealThick() * 100); // 乘以100并四舍五入
|
||||||
int entryThick = (int) Math.round(form.getEntryThick() * 100); // 乘以100并四舍五入
|
// int entryThick = (int) Math.round(form.getEntryThick() * 100); // 乘以100并四舍五入
|
||||||
int exitThick = (int) Math.round(form.getExitThick() * 100); // 乘以100并四舍五入
|
// int exitThick = (int) Math.round(form.getExitThick() * 100); // 乘以100并四舍五入
|
||||||
|
//
|
||||||
// 格式化为三位数字
|
// // 格式化为三位数字
|
||||||
String annealThickStr = String.format("%03d", annealThick);
|
// String annealThickStr = String.format("%03d", annealThick);
|
||||||
String entryThickStr = String.format("%03d", entryThick);
|
// String entryThickStr = String.format("%03d", entryThick);
|
||||||
String exitThickStr = String.format("%03d", exitThick);
|
// String exitThickStr = String.format("%03d", exitThick);
|
||||||
|
//
|
||||||
// 根据字段构建 calcId
|
// // 根据字段构建 calcId
|
||||||
String calcId = form.getGrade() + annealThickStr + entryThickStr + exitThickStr + form.getPassno();
|
// String calcId = form.getGrade() + annealThickStr + entryThickStr + exitThickStr + form.getPassno();
|
||||||
|
|
||||||
// 实际查询代码(根据 calcId 查询数据)
|
// 实际查询代码(根据 calcId 查询数据)
|
||||||
// 这里假设查询方法为根据 calcId 查找结果
|
// 这里假设查询方法为根据 calcId 查找结果
|
||||||
LambdaQueryWrapper<ModSetupResult> queryWrapper = new LambdaQueryWrapper<>();
|
// LambdaQueryWrapper<ModSetupResult> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(ModSetupResult::getCalcId, calcId);
|
// queryWrapper.eq(ModSetupResult::getCalcId, calcId);
|
||||||
|
|
||||||
List<ModSetupResult> results = this.baseMapper.selectList(queryWrapper);
|
|
||||||
|
|
||||||
|
|
||||||
return BeanUtil.copyToList(results, ModSetupResultVO.class);
|
return this.getSetupByCoilid(form.getCoilId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String calcSetup(CalcPdiPlanForm form) {
|
public String calcSetup(CalcPdiPlanForm form) {
|
||||||
|
|
||||||
//发送MQ
|
//发送MQ
|
||||||
MessageProperties props = MessagePropertiesBuilder.newInstance()
|
// MessageProperties props = MessagePropertiesBuilder.newInstance()
|
||||||
.setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN)
|
// .setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN)
|
||||||
.setMessageId("SETUP_CALL")
|
// .setMessageId("CALL_SETUP")
|
||||||
.build();
|
// .build();
|
||||||
rabbitTemplate.send(CommonConstants.RabbitMQ.SEND_MODEL,new Message(JSONUtil.toJsonStr(form).getBytes(StandardCharsets.UTF_8),props));
|
// rabbitTemplate.send(CommonConstants.RabbitMQ.SEND_MODEL,new Message(JSONUtil.toJsonStr(form).getBytes(StandardCharsets.UTF_8),props));
|
||||||
|
|
||||||
|
// 获取当前时间的毫秒级时间戳
|
||||||
|
long timestampMillis = LocalDateTime.now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli();
|
||||||
|
|
||||||
|
// 生成字符串:由 coilid 和当前时间戳拼接而成
|
||||||
|
String resultString = form.getCoilid() + timestampMillis;
|
||||||
|
|
||||||
|
// 先返回构建的字符串
|
||||||
|
// 这里是返回值先返回,后面调用副作用的逻辑
|
||||||
|
|
||||||
|
// 然后调用mockCalcResult方法,它是异步的,不会影响返回值
|
||||||
|
// mockCalcResult将会在返回之后执行,不影响calcSetup的返回
|
||||||
|
new Thread(() -> mockCalcResult(form.getCoilid(), resultString)).start();
|
||||||
|
|
||||||
|
// 返回值会先返回给调用者
|
||||||
|
return resultString;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mockCalcResult(String coilid, String string) {
|
||||||
|
|
||||||
|
List<ModSetupResultVO> setup = this.getSetupByCoilid(coilid);
|
||||||
|
|
||||||
|
|
||||||
|
ModSetupResultKeyVO modSetupResultKeyVO = new ModSetupResultKeyVO();
|
||||||
|
modSetupResultKeyVO.setKey(string);
|
||||||
|
modSetupResultKeyVO.setLists(setup);
|
||||||
|
//socket
|
||||||
|
WebSocketUtil.sendMessage(WsTypeEnum.calc_setup_result,JSONUtil.toJsonStr(modSetupResultKeyVO));
|
||||||
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String retrySetup(String coilid) {
|
public String retrySetup(String coilid) {
|
||||||
|
|
||||||
//发送MQ
|
try {
|
||||||
MessageProperties props = MessagePropertiesBuilder.newInstance()
|
//发送MQ
|
||||||
.setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN)
|
MessageProperties props = MessagePropertiesBuilder.newInstance()
|
||||||
.setMessageId("SETUP_CALL")
|
.setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN)
|
||||||
.build();
|
.setMessageId("CALL_SETUP")
|
||||||
rabbitTemplate.send(CommonConstants.RabbitMQ.SEND_MODEL,new Message(coilid.getBytes(StandardCharsets.UTF_8),props));
|
.build();
|
||||||
|
rabbitTemplate.send(CommonConstants.RabbitMQ.SEND_MODEL,new Message(coilid.getBytes(StandardCharsets.UTF_8),props));
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
return null;
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -103,4 +139,6 @@ public class ModSetupResultServiceImpl extends ServiceImpl<ModSetupResultMapper,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.fizz.business.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fizz.business.domain.ProMatmap;
|
||||||
|
import com.fizz.business.mapper.ProMatmapMapper;
|
||||||
|
import com.fizz.business.service.ProMatmapService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ProMatmapServiceImpl extends ServiceImpl<ProMatmapMapper, ProMatmap> implements ProMatmapService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProMatmapMapper proMatmapMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMatid(String matid) {
|
||||||
|
proMatmapMapper.updateMatidByDisplayName(matid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.fizz.business.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModSetupResultKeyVO {
|
||||||
|
|
||||||
|
String key;
|
||||||
|
|
||||||
|
List<ModSetupResultVO> lists;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -103,16 +103,4 @@ public class ModSetupResultVO {
|
|||||||
@ApiModelProperty(value = "计算ID 实际用的这个值")
|
@ApiModelProperty(value = "计算ID 实际用的这个值")
|
||||||
private String calcId;
|
private String calcId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "记录插入时间")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime insdate;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "更新时间")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
15
business/src/main/resources/mapper/ProMatmapMapper.xml
Normal file
15
business/src/main/resources/mapper/ProMatmapMapper.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?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.fizz.business.mapper.ProMatmapMapper">
|
||||||
|
|
||||||
|
<!-- 更新 pro_matmap 表的 matid 字段 -->
|
||||||
|
<update id="updateMatidByDisplayName">
|
||||||
|
UPDATE pro_matmap
|
||||||
|
SET matid = #{matid}
|
||||||
|
WHERE display_name = 'MILL'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
0
business/src/main/resources/rabbitmq.http
Normal file
0
business/src/main/resources/rabbitmq.http
Normal file
Reference in New Issue
Block a user