Commit 0a1e841f authored by wanghao's avatar wanghao

1 老化过程中 获取卡号,获取IOT状态调整中

parent 1235fb46
......@@ -228,6 +228,11 @@ public class PalletDeviceBinding extends BaseEntity
*/
private String nbCode;
/**
* 上报时间 从iot获取的时间
*/
private String reportTime;
public String getDeviceStatus() {
return deviceStatus;
}
......@@ -580,6 +585,14 @@ public class PalletDeviceBinding extends BaseEntity
this.nbCode = nbCode;
}
public String getReportTime() {
return reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -170,6 +170,19 @@ public class PalletDeviceUploadFailure extends BaseEntity
@Excel(name = "iot状态(0-异常,1-正常)")
private Integer iotStatus;
/**
* 上报时间 从iot获取的时间
*/
private String reportTime;
public String getReportTime() {
return reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
public void setId(Long id)
{
this.id = id;
......
......@@ -182,6 +182,19 @@ public class PalletDeviceUploadHistory extends BaseEntity
/** iot状态 0-异常 1-正常 */
@Excel(name = "iot状态(0-异常,1-正常)")
private Integer iotStatus;
/**
* 上报时间 从iot获取的时间
*/
private String reportTime;
public String getReportTime() {
return reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
public void setId(Long id)
{
this.id = id;
......
......@@ -93,7 +93,7 @@ public interface IRobotArmCommandService
public int findNotCompletedCommand(String command);
void generateBlankingCommand(String trayCode,String storeyCode,String command);
void generateBlankingCommand(String trayCode,String storeyCode,String command,String productStandardInspectionNumber);
void sendHomeCommand();
......
......@@ -194,10 +194,12 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
log.info("已发送断电指令 - 设备:{} 层:{}", tEquipmentInfo.getfEquipmentCode(), layer);
master.destroy();
ProductStandardInspection productStandardInspection = productStandardInspectionMapper.selectByNumber(command.getProductStandardInspectionNumber());
if("1".equals(productStandardInspection.getHasUpload())){
log.info("子任务开始查询IOT状态了" );
eventPublisher.publishEvent(new IotStatusEvent(this, storeyCode));
if(StringUtils.isNotBlank(command.getProductStandardInspectionNumber())){
ProductStandardInspection productStandardInspection = productStandardInspectionMapper.selectByNumber(command.getProductStandardInspectionNumber());
if(productStandardInspection != null && "1".equals(productStandardInspection.getHasUpload())){
log.info("子任务开始查询IOT状态了" );
eventPublisher.publishEvent(new IotStatusEvent(this, storeyCode));
}
}
// 如果正常 则发送 IOT请求
} catch (ModbusTransportException | ModbusInitException e) {
......@@ -305,7 +307,7 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
* @param command c
*/
@Override
public void generateBlankingCommand(String trayCode,String storeyCode,String command) {
public void generateBlankingCommand(String trayCode,String storeyCode,String command,String productStandardInspectionNumber) {
// 创建机械臂任务
RobotArmCommand robotArmCommand = new RobotArmCommand();
robotArmCommand.setType("1");
......@@ -314,6 +316,9 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
robotArmCommand.setStoreyCode(storeyCode);
robotArmCommand.setCreateTime(new Date());
robotArmCommand.setCommand(command);
if(StringUtils.isNotBlank(productStandardInspectionNumber)){
robotArmCommand.setProductStandardInspectionNumber(productStandardInspectionNumber);
}
robotArmCommandMapper.insertRobotArmCommand(robotArmCommand);
notifyCommandsUpdate();
}
......
......@@ -657,7 +657,7 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
}
if(tTrayInfo != null) {
robotArmCommandService.generateBlankingCommand(tTrayInfo.getfTrayCode(), tStoreyInfo.getfStoreyCode(), command);
robotArmCommandService.generateBlankingCommand(tTrayInfo.getfTrayCode(), tStoreyInfo.getfStoreyCode(), command,null);
}
} else {
robotArmCommandService.sendCommand(command);
......
......@@ -162,7 +162,9 @@ public class AgingStageFourProcessJob implements Job {
// cleanUpJobs(fStoreyId,context);
// 8. 发送机械臂指令(单独捕获异常)
try {
robotArmCommandService.generateBlankingCommand(tStoreyInfo.getfTrayCode(), storeyCode, tStoreyInfo.getBlankingCommand());
List<PalletDeviceBinding> palletDeviceBindings = palletDeviceBindingMapper.listByStoreyCode(storeyCode);
String productStandardInspectionNumber = palletDeviceBindings.get(0).getProductStandardInspectionNumber();
robotArmCommandService.generateBlankingCommand(tStoreyInfo.getfTrayCode(), storeyCode, tStoreyInfo.getBlankingCommand(),productStandardInspectionNumber);
log.info("机械臂指令发送完成:fStoreyId={};trayCode={};storeyCode={};blankingCommand={}", fStoreyId,tStoreyInfo.getfTrayCode(),storeyCode,tStoreyInfo.getBlankingCommand());
} catch (Exception e) {
log.error("机械臂指令发送异常:fStoreyId={}", fStoreyId, e);
......
......@@ -291,7 +291,7 @@ public class AllCommandHandler {
}
// 6. 根据结果设置状态(应用到该主板下的所有设备)
Integer statusToSet;
int statusToSet;
if (StringUtils.isNotBlank(result)) {
Map<String, String> dataMap = iotDataAndTokenUtil.processIotData(result);
......@@ -299,6 +299,7 @@ public class AllCommandHandler {
if (dataMap != null && !dataMap.isEmpty()) {
String reportTimeStr = dataMap.get("reportTime");
Date bindingTime = palletDeviceBinding.getBindingTime();
palletDeviceBinding.setReportTime(reportTimeStr);
if (StringUtils.isNotBlank(reportTimeStr) && bindingTime != null) {
try {
......
......@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="simCardNo" column="f_sim_card_no" />
<result property="iotStatus" column="f_iot_status" />
<result property="nbCode" column="f_nb_code"/>
<result property="reportTime" column="f_report_time"/>
</resultMap>
......@@ -99,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
palDeviceBinding.f_sim_card_no,
palDeviceBinding.f_iot_status,
palDeviceBinding.f_nb_code,
palDeviceBinding.f_report_time,
inspection.f_reading_mode,
inspection.f_has_upload
from t_pallet_device_binding palDeviceBinding
......@@ -209,6 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
palDeviceBinding.f_sim_card_no,
palDeviceBinding.f_iot_status,
palDeviceBinding.f_nb_code,
palDeviceBinding.f_report_time,
inspection.f_reading_mode,
inspection.f_has_upload
from t_pallet_device_binding palDeviceBinding
......@@ -290,7 +293,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_standard_inspect_result = null,
f_sim_card_no = null,
f_iot_status = null,
f_nb_code = null
f_nb_code = null,
f_report_time = null
where f_tray_id = #{trayId}
</update>
<insert id="insertPalletDeviceBinding" parameterType="PalletDeviceBinding" useGeneratedKeys="true" keyProperty="palletDeviceBindingId">
......@@ -358,7 +362,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_standard_inspect_result = null,
f_sim_card_no = null,
f_iot_status = null,
f_nb_code = null
f_nb_code = null,
f_report_time = null
where f_pallet_device_binding_id = #{palletDeviceBindingId}
</update>
<update id="updatePalletDeviceBinding" parameterType="PalletDeviceBinding">
......@@ -406,6 +411,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="simCardNo != null">f_sim_card_no = #{simCardNo},</if>
<if test="iotStatus != null">f_iot_status = #{iotStatus},</if>
<if test="nbCode != null">f_nb_code = #{nbCode},</if>
<if test="reportTime != null">f_report_time = #{reportTime},</if>
</trim>
where f_pallet_device_binding_id = #{palletDeviceBindingId} and f_motherboard_code is not null
</update>
......@@ -444,7 +450,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="batchUpdateIotStatus" parameterType="list">
<foreach collection="palletDeviceBindingList" item="item" index="index" separator=";">
UPDATE t_pallet_device_binding
SET f_iot_status = #{item.iotStatus}
SET f_iot_status = #{item.iotStatus},
f_report_time = #{item.reportTime}
where f_pallet_device_binding_id = #{item.palletDeviceBindingId}
</foreach>
</update>
......@@ -483,7 +490,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_standard_inspect_result = null,
f_sim_card_no = null,
f_iot_status = null,
f_nb_code = null
f_nb_code = null,
f_report_time = null
<choose>
<when test="item.motherboardCode != null">
, f_motherboard_code = #{item.motherboardCode}
......@@ -527,7 +535,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_standard_inspect_result = null,
f_sim_card_no = null,
f_iot_status = null,
f_nb_code = null
f_nb_code = null,
f_report_time = null
where f_tray_id = #{trayId}
</update>
......
......@@ -44,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="hasUpload" column="f_has_upload"/>
<result property="simCardNo" column="f_sim_card_no" />
<result property="iotStatus" column="f_iot_status" />
<result property="reportTime" column="f_report_time"/>
</resultMap>
<sql id="selectPalletDeviceUploadFailureVo">
......@@ -86,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
palDeviceBinding.f_standard_inspect_result,
palDeviceBinding.f_sim_card_no,
palDeviceBinding.f_iot_status,
palDeviceBinding.f_report_time,
inspection.f_has_upload
from t_pallet_device_upload_failure palDeviceBinding
left join t_tray_info trayInfo on trayInfo.f_tray_id = palDeviceBinding.f_tray_id
......@@ -177,7 +179,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_product_standard_inspection_number,
f_standard_inspect_result,
f_sim_card_no,
f_iot_status
f_iot_status,
f_report_time,
</trim>
values
<foreach collection="list" item="item" separator=",">
......@@ -218,7 +221,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.productStandardInspectionNumber},
#{item.standardInspectResult},
#{item.simCardNo},
#{item.iotStatus}
#{item.iotStatus},
#{item.reportTime}
</trim>
</foreach>
</insert>
......@@ -261,7 +265,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_product_standard_inspection_number,
f_standard_inspect_result,
f_sim_card_no,
f_iot_status
f_iot_status,
f_report_time
</trim>
values
<foreach collection="list" item="item" separator=",">
......@@ -302,7 +307,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.productStandardInspectionNumber},
#{item.standardInspectResult},
#{item.simCardNo},
#{item.iotStatus}
#{item.iotStatus},
#{item.reportTime}
</trim>
</foreach>
</insert>
......@@ -344,9 +350,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="networkStatus != null">f_network_status,</if>
<if test="productStandardInspectionNumber != null">f_product_standard_inspection_number,</if>
<if test="standardInspectResult != null">f_standard_inspect_result,</if>
<if test="simCardNo != null">f_sim_card_no,</if>
<if test="iotStatus != null">f_iot_status,</if>
<if test="reportTime != null">f_report_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="trayId != null">#{trayId},</if>
......@@ -386,6 +392,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="standardInspectResult != null">#{standardInspectResult},</if>
<if test="simCardNo != null">#{simCardNo},</if>
<if test="iotStatus != null">#{iotStatus},</if>
<if test="reportTime != null">#{reportTime},</if>
</trim>
</insert>
......@@ -429,6 +436,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="standardInspectResult != null">f_standard_inspect_result = #{standardInspectResult},</if>
<if test="simCardNo != null">f_sim_card_no = #{simCardNo},</if>
<if test="iotStatus != null">f_iot_status = #{iotStatus},</if>
<if test="reportTime != null">f_report_time = #{reportTime},</if>
</trim>
where f_id = #{id}
</update>
......
......@@ -46,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="simCardNo" column="f_sim_card_no" />
<result property="iotStatus" column="f_iot_status" />
<result property="reportTime" column="f_report_time"/>
</resultMap>
<sql id="selectPalletDeviceUploadHistoryVo">
......@@ -87,7 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
palDeviceBinding.f_product_standard_inspection_number,
palDeviceBinding.f_standard_inspect_result,
palDeviceBinding.f_sim_card_no,
palDeviceBinding.f_iot_status
palDeviceBinding.f_iot_status,
palDeviceBinding.f_report_time
from t_pallet_device_upload_history palDeviceBinding
left join t_tray_info trayInfo on trayInfo.f_tray_id = palDeviceBinding.f_tray_id
</sql>
......@@ -147,7 +149,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_product_standard_inspection_number,
f_standard_inspect_result,
f_sim_card_no,
f_iot_status
f_iot_status,
f_report_time
</trim>
values
<foreach collection="list" item="item" separator=",">
......@@ -188,7 +191,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.productStandardInspectionNumber},
#{item.standardInspectResult},
#{item.simCardNo},
#{item.iotStatus}
#{item.iotStatus},
#{item.reportTime}
</trim>
</foreach>
</insert>
......@@ -232,7 +236,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_product_standard_inspection_number,
f_standard_inspect_result,
f_sim_card_no,
f_iot_status
f_iot_status,
f_report_time
</trim>
values
<foreach collection="list" item="item" separator=",">
......@@ -273,7 +278,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.productStandardInspectionNumber},
#{item.standardInspectResult},
#{item.simCardNo},
#{item.iotStatus}
#{item.iotStatus},
#{item.reportTime}
</trim>
</foreach>
</insert>
......@@ -317,6 +323,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="standardInspectResult != null">f_standard_inspect_result,</if>
<if test="simCardNo != null">f_sim_card_no,</if>
<if test="iotStatus != null">f_iot_status,</if>
<if test="reportTime != null">f_report_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="trayId != null">#{trayId},</if>
......@@ -329,6 +336,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bindingTime != null">#{bindingTime},</if>
<if test="unbindingTime != null">#{unbindingTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="reportTime != null">#{reportTime},</if>
<if test="deviceStatus != null">#{deviceStatus},</if>
<if test="recordYear != null">#{recordYear},</if>
<if test="recordMonth != null">#{recordMonth},</if>
......@@ -402,6 +410,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="simCardNo != null">f_sim_card_no = #{simCardNo},</if>
<if test="iotStatus != null">f_iot_status = #{iotStatus},</if>
<if test="reportTime != null">f_report_time = #{reportTime},</if>
</trim>
where f_id = #{id}
</update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment