master
lzq 2025-12-29 20:45:03 +08:00
parent ad8281da87
commit e72e1c10a9
6 changed files with 397 additions and 138 deletions

View File

@ -0,0 +1,41 @@
package com.njzscloud.dispose.dev;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class DiscoverTruckMsg {
/**
*
*/
private String id;
/**
*
*/
private String sn;
/**
*
*/
private boolean front;
/**
*
*/
private String groupSn;
/**
*
*/
private String barrierSn;
/**
*
*/
private String licensePlate;
/**
* base64
*/
private String image;
}

View File

@ -0,0 +1,41 @@
package com.njzscloud.dispose.dev;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class ObtainTruckDataResultMsg {
/**
*
*/
private String id;
/**
*
*/
private String sn;
/**
*
*/
private String groupSn;
/**
*
*/
private String barrierSn;
/**
* base64
*/
private String image;
/**
*
*/
private Integer weight;
/**
*
*/
private Boolean success;
}

View File

@ -0,0 +1,35 @@
package com.njzscloud.dispose.dev;
import com.njzscloud.common.core.tuple.Tuple2;
import com.njzscloud.common.mqtt.support.MqttListener;
import com.njzscloud.common.mqtt.support.MqttMsg;
import org.springframework.stereotype.Component;
import static com.njzscloud.dispose.event.SysMittEvent.DISCOVER_TRUCK;
import static com.njzscloud.dispose.event.SysMittEvent.OBTAIN_TRUCK_DATA_REPLY;
@Component
public class Wbs {
@MqttListener(topic = "discover_truck")
public void discoverTruck(MqttMsg msg) {
DiscoverTruckMsg discoverTruckMsg = msg.getMsg(DiscoverTruckMsg.class);
WbsHandle wbsHandle = new WbsHandle(discoverTruckMsg.getId(),
discoverTruckMsg.getSn(),
discoverTruckMsg.getGroupSn(),
discoverTruckMsg.getBarrierSn());
DISCOVER_TRUCK.emit(Tuple2.of(discoverTruckMsg, wbsHandle));
}
@MqttListener(topic = "obtain_truck_data/reply")
public void obtainTruckDataReply(MqttMsg msg) {
ObtainTruckDataResultMsg obtainTruckDataResultMsg = msg.getMsg(ObtainTruckDataResultMsg.class);
WbsHandle wbsHandle = new WbsHandle(obtainTruckDataResultMsg.getId(),
obtainTruckDataResultMsg.getSn(),
obtainTruckDataResultMsg.getGroupSn(),
obtainTruckDataResultMsg.getBarrierSn());
OBTAIN_TRUCK_DATA_REPLY.emit(Tuple2.of(obtainTruckDataResultMsg, wbsHandle));
}
}

View File

@ -0,0 +1,78 @@
package com.njzscloud.dispose.dev;
import cn.hutool.core.map.MapUtil;
import com.njzscloud.common.mqtt.util.Mqtt;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class WbsHandle {
/**
*
*/
public final String id;
/**
*
*/
public final String sn;
/**
*
*/
public final String groupSn;
/**
*
*/
public final String barrierSn;
/**
*
*
* @param content
* @param times
*/
public void playVoice(String content, int times) {
if (times < 1) {
times = 1;
}
Mqtt.publish(sn + "/play_voice", MapUtil.builder()
.put("id", id)
.put("groupSn", groupSn)
.put("barrierSn", barrierSn)
.put("content", content)
.put("times", times)
.build());
}
/**
* 1
*
* @param content
*/
public void playVoice(String content) {
playVoice(content, 1);
}
/**
*
*
* @param orderId ID
*/
public void obtainTruckData(Long orderId) {
Mqtt.publish(sn + "/obtain_truck_data", MapUtil.builder()
.put("id", id)
.put("orderId", orderId.toString())
.put("groupSn", groupSn)
.put("barrierSn", barrierSn)
.build());
}
/**
*
*/
public void open() {
Mqtt.publish(sn + "/open", MapUtil.builder()
.put("id", id)
.put("groupSn", groupSn)
.put("barrierSn", barrierSn)
.build());
}
}

View File

@ -1,6 +1,10 @@
package com.njzscloud.dispose.event; package com.njzscloud.dispose.event;
import com.njzscloud.common.core.mitt.MittEvent; import com.njzscloud.common.core.mitt.MittEvent;
import com.njzscloud.common.core.tuple.Tuple2;
import com.njzscloud.dispose.dev.DiscoverTruckMsg;
import com.njzscloud.dispose.dev.ObtainTruckDataResultMsg;
import com.njzscloud.dispose.dev.WbsHandle;
import java.util.List; import java.util.List;
@ -17,4 +21,16 @@ public class SysMittEvent {
public static MittEvent<Long> SALES_ORDER = () -> { public static MittEvent<Long> SALES_ORDER = () -> {
}; };
/**
*
*/
public static MittEvent<Tuple2<DiscoverTruckMsg, WbsHandle>> DISCOVER_TRUCK = () -> {
};
/**
*
*/
public static MittEvent<Tuple2<ObtainTruckDataResultMsg, WbsHandle>> OBTAIN_TRUCK_DATA_REPLY = () -> {
};
} }

View File

@ -31977,74 +31977,6 @@
"attr20": null, "attr20": null,
"origin": "PASTE" "origin": "PASTE"
}, },
{
"id": "534B410A-5D21-4C88-A134-B1D419C9E4AD",
"defKey": "order_category",
"defName": "单据类型",
"intro": null,
"baseDataType": "VARCHAR",
"bizDomainType": "",
"dbDataType": "VARCHAR",
"dataLen": 16,
"numScale": null,
"primaryKey": 0,
"notNull": 1,
"autoIncrement": 0,
"defaultValue": null,
"stndDictId": "order_category",
"stndFieldId": null,
"stndDictKey": "order_category",
"stndFieldKey": null,
"stndComplianceLevel": null,
"stndComplianceType": null,
"dictFrom": "Manual",
"dictItems": [
{
"itemKey": "XiaoShou",
"itemName": "销售",
"parentKey": "",
"intro": "",
"id": "A7B0FB0C-CDB4-4AC3-BC1E-B178A82AA5B4"
},
{
"itemKey": "CaiGou",
"itemName": "采购",
"parentKey": "",
"intro": "",
"id": "7938B08C-655D-46ED-B0C0-9F2BC79D66DD"
},
{
"itemKey": "QiTa",
"itemName": "其他",
"parentKey": "",
"intro": "",
"id": "D09CB9BB-41B8-48FE-A704-ED77FCBFF558"
}
],
"fieldTier": "",
"mark": null,
"attr1": null,
"attr2": null,
"attr3": null,
"attr4": null,
"attr5": null,
"attr6": null,
"attr7": null,
"attr8": null,
"attr9": null,
"attr10": null,
"attr11": null,
"attr12": null,
"attr13": null,
"attr14": null,
"attr15": null,
"attr16": null,
"attr17": null,
"attr18": null,
"attr19": null,
"attr20": null,
"origin": "PASTE"
},
{ {
"id": "865890E6-38D4-4A8B-921B-90377597BB5E", "id": "865890E6-38D4-4A8B-921B-90377597BB5E",
"defKey": "order_id", "defKey": "order_id",
@ -33022,74 +32954,6 @@
"attr20": null, "attr20": null,
"origin": "PASTE" "origin": "PASTE"
}, },
{
"id": "24433B38-6C1A-4B68-AE13-D61983DF02EF",
"defKey": "order_category",
"defName": "单据类型",
"intro": null,
"baseDataType": "VARCHAR",
"bizDomainType": "",
"dbDataType": "VARCHAR",
"dataLen": 16,
"numScale": null,
"primaryKey": 0,
"notNull": 1,
"autoIncrement": 0,
"defaultValue": null,
"stndDictId": "order_category",
"stndFieldId": null,
"stndDictKey": "order_category",
"stndFieldKey": null,
"stndComplianceLevel": null,
"stndComplianceType": null,
"dictFrom": "Manual",
"dictItems": [
{
"itemKey": "XiaoShou",
"itemName": "销售",
"parentKey": "",
"intro": "",
"id": "A7B0FB0C-CDB4-4AC3-BC1E-B178A82AA5B4"
},
{
"itemKey": "CaiGou",
"itemName": "采购",
"parentKey": "",
"intro": "",
"id": "7938B08C-655D-46ED-B0C0-9F2BC79D66DD"
},
{
"itemKey": "QiTa",
"itemName": "其他",
"parentKey": "",
"intro": "",
"id": "D09CB9BB-41B8-48FE-A704-ED77FCBFF558"
}
],
"fieldTier": "",
"mark": null,
"attr1": null,
"attr2": null,
"attr3": null,
"attr4": null,
"attr5": null,
"attr6": null,
"attr7": null,
"attr8": null,
"attr9": null,
"attr10": null,
"attr11": null,
"attr12": null,
"attr13": null,
"attr14": null,
"attr15": null,
"attr16": null,
"attr17": null,
"attr18": null,
"attr19": null,
"attr20": null,
"origin": "PASTE"
},
{ {
"id": "7CB115F5-8C8A-4C28-B8EF-3C4BF550EA68", "id": "7CB115F5-8C8A-4C28-B8EF-3C4BF550EA68",
"defKey": "order_id", "defKey": "order_id",
@ -33883,6 +33747,98 @@
"attr20": null, "attr20": null,
"origin": "PASTE" "origin": "PASTE"
}, },
{
"id": "33F588A7-7BE3-4D7E-8CB1-A167A63E8B8A",
"defKey": "order_id",
"defName": "预约单 Id",
"intro": "cst_order.id",
"baseDataType": "BIGINT",
"bizDomainType": "",
"dbDataType": "BIGINT",
"dataLen": null,
"numScale": null,
"primaryKey": 0,
"notNull": 0,
"autoIncrement": 0,
"defaultValue": null,
"stndDictId": null,
"stndFieldId": null,
"stndDictKey": null,
"stndFieldKey": null,
"stndComplianceLevel": null,
"stndComplianceType": null,
"dictFrom": "",
"dictItems": null,
"fieldTier": "",
"mark": null,
"attr1": null,
"attr2": null,
"attr3": null,
"attr4": null,
"attr5": null,
"attr6": null,
"attr7": null,
"attr8": null,
"attr9": null,
"attr10": null,
"attr11": null,
"attr12": null,
"attr13": null,
"attr14": null,
"attr15": null,
"attr16": null,
"attr17": null,
"attr18": null,
"attr19": null,
"attr20": null,
"origin": "PASTE"
},
{
"id": "46C80057-CCDB-4362-95E8-4FAC711812F7",
"defKey": "order_trans_id",
"defName": "预约单车次 Id",
"intro": "cst_order_trans.id",
"baseDataType": "BIGINT",
"bizDomainType": "",
"dbDataType": "BIGINT",
"dataLen": "",
"numScale": "",
"primaryKey": 0,
"notNull": 0,
"autoIncrement": 0,
"defaultValue": "",
"stndDictId": "",
"stndFieldId": "",
"stndDictKey": "",
"stndFieldKey": "",
"stndComplianceLevel": "",
"stndComplianceType": "",
"dictFrom": "",
"dictItems": null,
"fieldTier": "",
"mark": null,
"attr1": "",
"attr2": "",
"attr3": "",
"attr4": "",
"attr5": "",
"attr6": "",
"attr7": "",
"attr8": "",
"attr9": "",
"attr10": "",
"attr11": "",
"attr12": "",
"attr13": "",
"attr14": "",
"attr15": "",
"attr16": "",
"attr17": "",
"attr18": "",
"attr19": "",
"attr20": "",
"origin": "UI"
},
{ {
"id": "05D96AA0-5321-4D27-8A58-4EE0460CB7AC", "id": "05D96AA0-5321-4D27-8A58-4EE0460CB7AC",
"defKey": "purchase_order_status", "defKey": "purchase_order_status",
@ -34843,6 +34799,98 @@
"attr20": null, "attr20": null,
"origin": "PASTE" "origin": "PASTE"
}, },
{
"id": "F387AF68-B6B6-4EF1-AFBC-2213BC711EAC",
"defKey": "order_id",
"defName": "预约单 Id",
"intro": "cst_order.id",
"baseDataType": "BIGINT",
"bizDomainType": "",
"dbDataType": "BIGINT",
"dataLen": null,
"numScale": null,
"primaryKey": 0,
"notNull": 0,
"autoIncrement": 0,
"defaultValue": "",
"stndDictId": null,
"stndFieldId": null,
"stndDictKey": null,
"stndFieldKey": null,
"stndComplianceLevel": null,
"stndComplianceType": null,
"dictFrom": "",
"dictItems": null,
"fieldTier": "",
"mark": null,
"attr1": null,
"attr2": null,
"attr3": null,
"attr4": null,
"attr5": null,
"attr6": null,
"attr7": null,
"attr8": null,
"attr9": null,
"attr10": null,
"attr11": null,
"attr12": null,
"attr13": null,
"attr14": null,
"attr15": null,
"attr16": null,
"attr17": null,
"attr18": null,
"attr19": null,
"attr20": null,
"origin": "PASTE"
},
{
"id": "E0E33DE4-34B4-488E-B679-20DA8F88C107",
"defKey": "order_trans_id",
"defName": "预约单车次 Id",
"intro": "cst_order_trans.id",
"baseDataType": "BIGINT",
"bizDomainType": "",
"dbDataType": "BIGINT",
"dataLen": "",
"numScale": "",
"primaryKey": 0,
"notNull": 0,
"autoIncrement": 0,
"defaultValue": "",
"stndDictId": "",
"stndFieldId": "",
"stndDictKey": "",
"stndFieldKey": "",
"stndComplianceLevel": "",
"stndComplianceType": "",
"dictFrom": "",
"dictItems": null,
"fieldTier": "",
"mark": null,
"attr1": "",
"attr2": "",
"attr3": "",
"attr4": "",
"attr5": "",
"attr6": "",
"attr7": "",
"attr8": "",
"attr9": "",
"attr10": "",
"attr11": "",
"attr12": "",
"attr13": "",
"attr14": "",
"attr15": "",
"attr16": "",
"attr17": "",
"attr18": "",
"attr19": "",
"attr20": "",
"origin": "PASTE"
},
{ {
"id": "D53F6AD5-1A84-4601-AD3F-2197BDA68264", "id": "D53F6AD5-1A84-4601-AD3F-2197BDA68264",
"defKey": "sales_order_status", "defKey": "sales_order_status",
@ -42411,7 +42459,7 @@
"readonly": false, "readonly": false,
"allowWs": false "allowWs": false
}, },
"updateTime": 1766568257801, "updateTime": 1766994831821,
"signature": "0b7c79e169f084c5db10948c471a274e", "signature": "f9d8b0d74151ca1e43b7cb40107c6119",
"branchId": "1111" "branchId": "1111"
} }