设备接口

Leon 4 years ago
parent 9ed8f5f895
commit 48d9f577dc

@ -0,0 +1,60 @@
package com.foreverwin.mesnac.common.config;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.config.JmsListenerContainerFactory;
import org.springframework.jms.core.JmsMessagingTemplate;
@Configuration
@ConditionalOnProperty(prefix = "spring.activemq", value = {"enabled"}, matchIfMissing = true)
public class ActiveMQConfig {
//☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
@Primary
@Bean(name = "defaultConnectionFactory")
public ActiveMQConnectionFactory defaultConnectionFactory(
@Value("${spring.activemq.brokerUrl}") String brokerUrl,
@Value("${spring.activemq.user}") String username,
@Value("${spring.activemq.password}") String password) {
return this.createConnectionFactory(brokerUrl, username, password);
}
private ActiveMQConnectionFactory createConnectionFactory (String brokerUrl, String username, String password) {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL(brokerUrl);
factory.setUserName(username);
factory.setPassword(password);
return factory;
}
//**************************************************************************************************************
@Primary
@Bean(name = "defaultJmsTemplate")
public JmsMessagingTemplate defaultJmsTemplate(
@Qualifier("defaultConnectionFactory") ActiveMQConnectionFactory connectionFactory) {
JmsMessagingTemplate template = new JmsMessagingTemplate(connectionFactory);
return template;
}
//☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
@Primary
@Bean(name = "defaultFactory")
public JmsListenerContainerFactory defaultFactory(
@Qualifier("defaultConnectionFactory") ActiveMQConnectionFactory connectionFactory) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
return factory;
}
}

@ -8,6 +8,14 @@ spring:
username: wip username: wip
password: wip password: wip
driver-class-name: oracle.jdbc.OracleDriver driver-class-name: oracle.jdbc.OracleDriver
activemq:
enabled: true
brokerUrl: tcp://localhost:61616?wireFormat.maxInactivityDuration=0
password: admin
user: admin
pool:
enabled: true
max-connections: 10
mybatis-plus: mybatis-plus:
statement-lazy-load: true statement-lazy-load: true

@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService; import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService;
import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -48,4 +50,27 @@ public class SurplusItemReturnController {
return R.ok(result); return R.ok(result);
} }
@ResponseBody
@GetMapping("/surplusReturn")
public R surplusReturn(String inventory, String length, String width, String qty) {
try {
if (StringUtil.isBlank(inventory)) {
throw BusinessException.build("物料条码不能为空!");
}
if (StringUtil.isBlank(length) && StringUtil.isBlank(width)) {
throw BusinessException.build("长度和宽度不能同时为空!");
}
if (StringUtil.isBlank(qty)) {
throw BusinessException.build("数量不能为空!");
}
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
surplusItemReturnService.surplusReturn(site, user, inventory, length, width, new BigDecimal(qty));
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok("物料条码【" +inventory+ "】余料退回操作成功!");
}
} }

@ -5,6 +5,8 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
@ -20,7 +22,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
*/ */
@TableName("Z_SURPLUS_ITEM_RETURN") @TableName("Z_SURPLUS_ITEM_RETURN")
public class SurplusItemReturn extends Model<SurplusItemReturn> { public class SurplusItemReturn extends Model<SurplusItemReturn> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -54,22 +55,22 @@ public class SurplusItemReturn extends Model<SurplusItemReturn> {
* *
*/ */
@TableField("LENGHT") @TableField("LENGHT")
private Double lenght; private String lenght;
/** /**
* *
*/ */
@TableField("WIDTH") @TableField("WIDTH")
private Double width; private String width;
/** /**
* *
*/ */
@TableField("QTY") @TableField("QTY")
private Double qty; private BigDecimal qty;
/** /**
* *
*/ */
@TableField("CREATE_USER_BO") @TableField("CREATE_USER")
private String createUserBo; private String createUser;
/** /**
* *
*/ */
@ -78,13 +79,13 @@ public class SurplusItemReturn extends Model<SurplusItemReturn> {
/** /**
* *
*/ */
@TableField("UPDATE_USER_BO") @TableField("MODIFU_USER")
private String updateUserBo; private String modifuUser;
/** /**
* *
*/ */
@TableField("UPDATED_DATE_TIME") @TableField("MODIFIED_DATE_TIME")
private LocalDateTime updatedDateTime; private LocalDateTime modifiedDateTime;
public String getHandle() { public String getHandle() {
@ -127,36 +128,36 @@ public class SurplusItemReturn extends Model<SurplusItemReturn> {
this.itemBo = itemBo; this.itemBo = itemBo;
} }
public Double getLenght() { public String getLenght() {
return lenght; return lenght;
} }
public void setLenght(Double lenght) { public void setLenght(String lenght) {
this.lenght = lenght; this.lenght = lenght;
} }
public Double getWidth() { public String getWidth() {
return width; return width;
} }
public void setWidth(Double width) { public void setWidth(String width) {
this.width = width; this.width = width;
} }
public Double getQty() { public BigDecimal getQty() {
return qty; return qty;
} }
public void setQty(Double qty) { public void setQty(BigDecimal qty) {
this.qty = qty; this.qty = qty;
} }
public String getCreateUserBo() { public String getCreateUser() {
return createUserBo; return createUser;
} }
public void setCreateUserBo(String createUserBo) { public void setCreateUser(String createUser) {
this.createUserBo = createUserBo; this.createUser = createUser;
} }
public LocalDateTime getCreatedDateTime() { public LocalDateTime getCreatedDateTime() {
@ -167,20 +168,20 @@ public class SurplusItemReturn extends Model<SurplusItemReturn> {
this.createdDateTime = createdDateTime; this.createdDateTime = createdDateTime;
} }
public String getUpdateUserBo() { public String getModifuUser() {
return updateUserBo; return modifuUser;
} }
public void setUpdateUserBo(String updateUserBo) { public void setModifuUser(String modifuUser) {
this.updateUserBo = updateUserBo; this.modifuUser = modifuUser;
} }
public LocalDateTime getUpdatedDateTime() { public LocalDateTime getModifiedDateTime() {
return updatedDateTime; return modifiedDateTime;
} }
public void setUpdatedDateTime(LocalDateTime updatedDateTime) { public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
this.updatedDateTime = updatedDateTime; this.modifiedDateTime = modifiedDateTime;
} }
public static final String HANDLE = "HANDLE"; public static final String HANDLE = "HANDLE";
@ -199,13 +200,13 @@ public static final String WIDTH = "WIDTH";
public static final String QTY = "QTY"; public static final String QTY = "QTY";
public static final String CREATE_USER_BO = "CREATE_USER_BO"; public static final String CREATE_USER = "CREATE_USER";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String UPDATE_USER_BO = "UPDATE_USER_BO"; public static final String MODIFU_USER = "MODIFU_USER";
public static final String UPDATED_DATE_TIME = "UPDATED_DATE_TIME"; public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
@Override @Override
@ -224,10 +225,10 @@ public static final String UPDATED_DATE_TIME = "UPDATED_DATE_TIME";
", lenght = " + lenght + ", lenght = " + lenght +
", width = " + width + ", width = " + width +
", qty = " + qty + ", qty = " + qty +
", createUserBo = " + createUserBo + ", createUser = " + createUser +
", createdDateTime = " + createdDateTime + ", createdDateTime = " + createdDateTime +
", updateUserBo = " + updateUserBo + ", modifuUser = " + modifuUser +
", updatedDateTime = " + updatedDateTime + ", modifiedDateTime = " + modifiedDateTime +
"}"; "}";
} }
} }

@ -3,6 +3,7 @@ package com.foreverwin.mesnac.dispatch.service;
import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.math.BigDecimal;
import java.util.Map; import java.util.Map;
/** /**
@ -26,4 +27,16 @@ public interface SurplusItemReturnService extends IService<SurplusItemReturn> {
* @return * @return
*/ */
Map<String, Object> getInventoryData(String site, String inventory); Map<String, Object> getInventoryData(String site, String inventory);
/**
* 退
*
* @param site
* @param user
* @param inventory
* @param length
* @param width
* @param qty
*/
void surplusReturn(String site, String user, String inventory, String length, String width, BigDecimal qty);
} }

@ -1,11 +1,14 @@
package com.foreverwin.mesnac.dispatch.service.impl; package com.foreverwin.mesnac.dispatch.service.impl;
import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.util.ExcelUtils;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.NumberUtil; import com.foreverwin.mesnac.common.util.NumberUtil;
import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.model.Inventory; import com.foreverwin.mesnac.meapi.model.Inventory;
import com.foreverwin.mesnac.meapi.service.InventoryService; import com.foreverwin.mesnac.meapi.service.InventoryService;
import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.meext.MEServices;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -13,12 +16,19 @@ import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn;
import com.foreverwin.mesnac.dispatch.mapper.SurplusItemReturnMapper; import com.foreverwin.mesnac.dispatch.mapper.SurplusItemReturnMapper;
import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService; import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sap.me.inventory.InventoryServiceInterface;
import com.sap.me.inventory.InventorySplitRequest;
import com.sap.me.inventory.NewSplitInventory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
/** /**
* <p> * <p>
@ -46,7 +56,7 @@ public class SurplusItemReturnServiceImpl extends ServiceImpl<SurplusItemReturnM
if (inventoryModel == null) { if (inventoryModel == null) {
throw BusinessException.build("物料条码【" + inventory +"】不存在!"); throw BusinessException.build("物料条码【" + inventory +"】不存在!");
} }
if (inventoryModel.getQtyOnHand() <= 0) { if (inventoryModel.getQtyOnHand().compareTo(BigDecimal.ZERO) <= 0) {
throw BusinessException.build("物料条码【" + inventory +"】没有可用数量!"); throw BusinessException.build("物料条码【" + inventory +"】没有可用数量!");
} }
@ -70,4 +80,75 @@ public class SurplusItemReturnServiceImpl extends ServiceImpl<SurplusItemReturnM
return map; return map;
} }
@Override
public void surplusReturn(String site, String user, String inventory, String length, String width, BigDecimal qty) {
String inventoryBo = HandleEnum.INVENTORY.getHandle(site, inventory);
Inventory inventoryModel = inventoryService.getById(inventoryBo);
if (inventoryModel == null) {
throw BusinessException.build("物料条码【" + inventory +"】不存在!");
}
BigDecimal qtyOnHand = inventoryModel.getQtyOnHand();
if (qtyOnHand.compareTo(BigDecimal.ZERO) <= 0) {
throw BusinessException.build("物料条码【" + inventory +"】没有可用数量!");
}
if (qtyOnHand.compareTo(qty) < 0) {
throw BusinessException.build("余料数量超过了物料条码现有数量【" +qtyOnHand+ "】!");
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InventoryServiceInterface meInventoryService;
try {
meInventoryService = MEServices.create("com.sap.me.inventory", "InventoryService", site);
} catch (Exception e) {
throw BusinessException.build("获取标准库存操作服务失败:" + e.getMessage());
}
//余料库存
StringBuffer _inventory = new StringBuffer(inventory);
if (StringUtil.notBlank(length)) {
_inventory.append("*"+length);
}
if (StringUtil.notBlank(width)) {
_inventory.append("*"+width);
}
String surplusInventory = _inventory.toString();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//库存拆分
try {
InventorySplitRequest request = new InventorySplitRequest();
request.setInventoryRef(inventoryBo);
request.setQuantityToSplit(qty);
List<NewSplitInventory> splitList = new ArrayList<>();
NewSplitInventory newSplitInventory = new NewSplitInventory();
newSplitInventory.setNewInventoryId(surplusInventory);
newSplitInventory.setQuantity(qty);
splitList.add(newSplitInventory);
request.setNewInventoryList(splitList);
meInventoryService.split(request);
} catch (Exception e) {
ExceptionUtil.throwException(e);
}
LocalDateTime dateTime = LocalDateTime.now();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//记录余料退回日志
SurplusItemReturn surplusItemReturn = new SurplusItemReturn();
surplusItemReturn.setHandle(UUID.randomUUID().toString());
surplusItemReturn.setSite(site);
surplusItemReturn.setParentInventory(inventory);
surplusItemReturn.setInventory(surplusInventory);
surplusItemReturn.setLenght(length);
surplusItemReturn.setWidth(width);
surplusItemReturn.setItemBo(inventoryModel.getItemBo());
surplusItemReturn.setQty(qty);
surplusItemReturn.setCreateUser(user);
surplusItemReturn.setCreatedDateTime(dateTime);
surplusItemReturn.setModifuUser(user);
surplusItemReturn.setModifiedDateTime(dateTime);
surplusItemReturnMapper.insert(surplusItemReturn);
}
} }

@ -12,15 +12,15 @@
<result column="LENGHT" property="lenght" /> <result column="LENGHT" property="lenght" />
<result column="WIDTH" property="width" /> <result column="WIDTH" property="width" />
<result column="QTY" property="qty" /> <result column="QTY" property="qty" />
<result column="CREATE_USER_BO" property="createUserBo" /> <result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" /> <result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="UPDATE_USER_BO" property="updateUserBo" /> <result column="MODIFU_USER" property="modifuUser" />
<result column="UPDATED_DATE_TIME" property="updatedDateTime" /> <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
HANDLE, SITE, INVENTORY, PARENT_INVENTORY, ITEM_BO, LENGHT, WIDTH, QTY, CREATE_USER_BO, CREATED_DATE_TIME, UPDATE_USER_BO, UPDATED_DATE_TIME HANDLE, SITE, INVENTORY, PARENT_INVENTORY, ITEM_BO, LENGHT, WIDTH, QTY, CREATE_USER, CREATED_DATE_TIME, MODIFU_USER, MODIFIED_DATE_TIME
</sql> </sql>
<!-- BaseMapper标准查询/修改/删除 --> <!-- BaseMapper标准查询/修改/删除 -->
@ -53,7 +53,7 @@
SELECT <include refid="Base_Column_List"></include> FROM Z_SURPLUS_ITEM_RETURN SELECT <include refid="Base_Column_List"></include> FROM Z_SURPLUS_ITEM_RETURN
<where> <where>
<if test="ew.entity.handle!=null"> <if test="ew.entity.handle!=null">
HANDLE=#{ew.handle} HANDLE=#{ew.handle}
</if> </if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if> <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if> <if test="ew.entity.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
@ -62,10 +62,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</where> </where>
</select> </select>
@ -74,20 +74,20 @@
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
<if test="ew.entity!=null"> <if test="ew.entity!=null">
<if test="ew.entity.handle!=null"> <if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle} HANDLE=#{ew.entity.handle}
</if> </if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if> <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if> <if test="ew.entity.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.parentInventory!=null"> AND PARENT_INVENTORY=#{ew.entity.parentInventory}</if> <if test="ew.entity.parentInventory!=null"> AND PARENT_INVENTORY=#{ew.entity.parentInventory}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if> <if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -114,10 +114,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -144,10 +144,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -174,10 +174,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -204,10 +204,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -234,10 +234,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -260,10 +260,10 @@
<if test="lenght!=null">LENGHT,</if> <if test="lenght!=null">LENGHT,</if>
<if test="width!=null">WIDTH,</if> <if test="width!=null">WIDTH,</if>
<if test="qty!=null">QTY,</if> <if test="qty!=null">QTY,</if>
<if test="createUserBo!=null">CREATE_USER_BO,</if> <if test="createUser!=null">CREATE_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if> <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="updateUserBo!=null">UPDATE_USER_BO,</if> <if test="modifuUser!=null">MODIFU_USER,</if>
<if test="updatedDateTime!=null">UPDATED_DATE_TIME,</if> <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES </trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
#{handle}, #{handle},
@ -274,10 +274,10 @@
<if test="lenght!=null">#{lenght},</if> <if test="lenght!=null">#{lenght},</if>
<if test="width!=null">#{width},</if> <if test="width!=null">#{width},</if>
<if test="qty!=null">#{qty},</if> <if test="qty!=null">#{qty},</if>
<if test="createUserBo!=null">#{createUserBo},</if> <if test="createUser!=null">#{createUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if> <if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="updateUserBo!=null">#{updateUserBo},</if> <if test="modifuUser!=null">#{modifuUser},</if>
<if test="updatedDateTime!=null">#{updatedDateTime},</if> <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim> </trim>
</insert> </insert>
@ -295,10 +295,10 @@
#{lenght}, #{lenght},
#{width}, #{width},
#{qty}, #{qty},
#{createUserBo}, #{createUser},
#{createdDateTime}, #{createdDateTime},
#{updateUserBo}, #{modifuUser},
#{updatedDateTime}, #{modifiedDateTime},
</trim> </trim>
</insert> </insert>
@ -312,11 +312,11 @@
<if test="et.lenght!=null">LENGHT=#{et.lenght},</if> <if test="et.lenght!=null">LENGHT=#{et.lenght},</if>
<if test="et.width!=null">WIDTH=#{et.width},</if> <if test="et.width!=null">WIDTH=#{et.width},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if> <if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if> <if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if> <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if> <if test="et.modifuUser!=null">MODIFU_USER=#{et.modifuUser},</if>
<if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</if> <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if> </trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update> </update>
@ -329,11 +329,11 @@
LENGHT=#{et.lenght}, LENGHT=#{et.lenght},
WIDTH=#{et.width}, WIDTH=#{et.width},
QTY=#{et.qty}, QTY=#{et.qty},
CREATE_USER_BO=#{et.createUserBo}, CREATE_USER=#{et.createUser},
CREATED_DATE_TIME=#{et.createdDateTime}, CREATED_DATE_TIME=#{et.createdDateTime},
UPDATE_USER_BO=#{et.updateUserBo}, MODIFU_USER=#{et.modifuUser},
UPDATED_DATE_TIME=#{et.updatedDateTime}, MODIFIED_DATE_TIME=#{et.modifiedDateTime},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if> </trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update> </update>
@ -346,10 +346,10 @@
<if test="et.lenght!=null">LENGHT=#{et.lenght},</if> <if test="et.lenght!=null">LENGHT=#{et.lenght},</if>
<if test="et.width!=null">WIDTH=#{et.width},</if> <if test="et.width!=null">WIDTH=#{et.width},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if> <if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if> <if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if> <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if> <if test="et.modifuUser!=null">MODIFU_USER=#{et.modifuUser},</if>
<if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</if> <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim> </trim>
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
@ -362,10 +362,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -409,10 +409,10 @@
<if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if> <if test="ew.entity.lenght!=null"> AND LENGHT=#{ew.entity.lenght}</if>
<if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if> <if test="ew.entity.width!=null"> AND WIDTH=#{ew.entity.width}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if> <if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if> <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if> <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if> <if test="ew.entity.modifuUser!=null"> AND MODIFU_USER=#{ew.entity.modifuUser}</if>
<if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}

@ -0,0 +1,60 @@
package com.foreverwin.mesnac.equip.consumer;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.equip.dto.MQResponseDto;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.messaging.MessageHeaders;
import org.springframework.stereotype.Component;
import javax.jms.Queue;
/**
* MQ
*
*
* @author Leon
* @date 2021-07-21
*/
@Component
@ConditionalOnProperty(prefix = "spring.activemq", value = {"enabled"}, matchIfMissing = true)
public class ResourceMQConsume {
private static Logger logger = LoggerFactory.getLogger(ResourceMQConsume.class);
@Autowired
private ResourceMQProcess resourceMQProcess;
@Autowired
@Qualifier("defaultJmsTemplate")
private JmsMessagingTemplate template;
@JmsListener(destination = "resource.status.process", containerFactory = "defaultFactory")
public void resourceStatusProcess(String text, MessageHeaders headers) {
logger.info("接收设备状态变更数据:" + text);
String resultString = resourceMQProcess.resourceStatusProcess(text);
//返回设备处理结果
template.convertAndSend((Queue) headers.get("jms_replyTo"), resultString);
}
@JmsListener(destination = "resource.alarm.process", containerFactory = "defaultFactory")
public void resourceAlarmProcess(String text, MessageHeaders headers) {
logger.info("接收设备报警数据:" + text);
template.convertAndSend((Queue) headers.get("jms_replyTo"), "");
}
@JmsListener(destination = "resource.edc.process", containerFactory = "defaultFactory")
public void resourceEdcProcess(String text) {
logger.info("接收设备参数数据:" + text);
}
}

@ -0,0 +1,79 @@
package com.foreverwin.mesnac.equip.consumer;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.equip.dto.MQResponseDto;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.modular.core.exception.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
*
*
* @author Leon
* @date 2021-07-21
*/
@Component
public class ResourceMQProcess {
@Autowired
private ResrceService resrceService;
/**
*
*
*
* /RUN(301|)/DOW(302|);/REPAIR(4/);/SEAL(303|);/FREE(2|)
* @param text
* @return
*/
public String resourceStatusProcess(String text) {
MQResponseDto mqResponseDto = new MQResponseDto();
try {
JSONObject jsonObject = JSONObject.parseObject(text);
String handle = jsonObject.getString("TRANID");
mqResponseDto.setHANDLE(handle);
String site = jsonObject.getString("SITE");
String resource = jsonObject.getString("RESOURCE");
String status = jsonObject.getString("STATUS");
if (StringUtil.isBlank(site)) {
throw BusinessException.build("站点不能为空!");
}
if (StringUtil.isBlank(resource)) {
throw BusinessException.build("设备编号不能为空!");
}
if (StringUtil.isBlank(status)) {
throw BusinessException.build("设备状态不能为空!");
}
String meStatus = "301";
//设备状态转换
switch (status) {
case "RUN" :
meStatus = "301"; break;
case "DOW" :
meStatus = "302"; break;
case "SEAL" :
meStatus = "303"; break;
case "FREE" :
meStatus = "2"; break;
case "REPAIR" :
meStatus = "4"; break;
}
resrceService.updateResourceStatus(site, resource, meStatus);
mqResponseDto.setSTATUS("S");
mqResponseDto.setMESSAGE("设备状态修改成功!");
} catch (Exception e) {
mqResponseDto.setSTATUS("E");
mqResponseDto.setMESSAGE("设备状态修改失败:" + e.getMessage());
}
return JSONObject.toJSONString(mqResponseDto);
}
}

@ -0,0 +1,44 @@
package com.foreverwin.mesnac.equip.dto;
import com.alibaba.fastjson.annotation.JSONField;
/**
* MQ
*
*
* @author Leon
* @date 2021-07-21
*/
public class MQResponseDto {
@JSONField
private String HANDLE;
@JSONField
private String STATUS;
@JSONField
private String MESSAGE;
public String getHANDLE() {
return HANDLE;
}
public void setHANDLE(String HANDLE) {
this.HANDLE = HANDLE;
}
public String getSTATUS() {
return STATUS;
}
public void setSTATUS(String STATUS) {
this.STATUS = STATUS;
}
public String getMESSAGE() {
return MESSAGE;
}
public void setMESSAGE(String MESSAGE) {
this.MESSAGE = MESSAGE;
}
}

@ -135,8 +135,7 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
// 修改设备状态---若stopMachie=Y则状态改为非预定停机 // 修改设备状态---若stopMachie=Y则状态改为非预定停机
if (stopMachine.equals("Y")){ if (stopMachine.equals("Y")){
String resourceNo = repairTask.getResourceNo(); String resourceNo = repairTask.getResourceNo();
String resourceBo = HandleEnum.RESOURCE.getHandle(site, resourceNo); resrceService.updateResourceStatus(site, resourceNo ,"5");
resrceService.updateResourceStatusByHandle(resourceBo,"5");
} }
} }
return repairTask; return repairTask;
@ -177,8 +176,7 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
String stopMachineT = repairTask.getStopMachine(); String stopMachineT = repairTask.getStopMachine();
if (!stopMachine.equals(stopMachineT)){ if (!stopMachine.equals(stopMachineT)){
String resourceNo = repairTask.getResourceNo(); String resourceNo = repairTask.getResourceNo();
String resourceBo = HandleEnum.RESOURCE.getHandle(site, resourceNo); resrceService.updateResourceStatus(site, resourceNo, stopMachineT.equals("N")?"301":"5");
resrceService.updateResourceStatusByHandle(resourceBo,stopMachineT.equals("N")?"301":"5");
} }
break; break;
case "302": case "302":

@ -51,7 +51,7 @@ public interface ResrceService extends IService<Resrce> {
/** /**
* *
*/ */
void updateResourceStatusByHandle(String handle,String status); void updateResourceStatus(String site, String resource, String status);
/** /**
* *

@ -69,9 +69,13 @@ public class ResrceServiceImpl extends ServiceImpl<ResrceMapper, Resrce> impleme
} }
@Override @Override
public void updateResourceStatusByHandle(String handle,String status) { public void updateResourceStatus(String site, String resource, String status) {
Resrce resrce = resrceMapper.selectById(handle); String statusBo = "StatusBo:" + site + "," + status;
resrce.setStatusBo("StatusBo:1000,"+status); String resourceBo = "ResourceBO:" + site + "," + resource;
Resrce resrce = new Resrce();
resrce.setHandle(resourceBo);
resrce.setStatusBo(statusBo);
resrceMapper.updateById(resrce); resrceMapper.updateById(resrce);
} }

Loading…
Cancel
Save