Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhmes-agecal
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhmes-agecal
Commits
5223744b
Commit
5223744b
authored
Nov 24, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 上传MES后 失败记录记录;
2 失败记录可以再重新上传,上传后记录成功多少,失败多少
parent
debf3249
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1825 additions
and
74 deletions
+1825
-74
PalletDeviceUploadHistoryController.java
...roller/equipment/PalletDeviceUploadHistoryController.java
+92
-0
HttpUtils.java
...src/main/java/com/zehong/common/utils/http/HttpUtils.java
+53
-62
PalletDeviceUploadHistory.java
...a/com/zehong/system/domain/PalletDeviceUploadHistory.java
+375
-0
PalletDeviceUploadHistoryMapper.java
...zehong/system/mapper/PalletDeviceUploadHistoryMapper.java
+63
-0
NettyUdpServerHandler.java
...om/zehong/system/netty/handler/NettyUdpServerHandler.java
+100
-12
IPalletDeviceUploadHistoryService.java
...ong/system/service/IPalletDeviceUploadHistoryService.java
+67
-0
PalletDeviceUploadHistoryServiceImpl.java
...em/service/impl/PalletDeviceUploadHistoryServiceImpl.java
+287
-0
PalletDeviceUploadHistoryMapper.xml
...sources/mapper/system/PalletDeviceUploadHistoryMapper.xml
+235
-0
palletDeviceUploadHistory.js
.../src/api/palletDeviceBinding/palletDeviceUploadHistory.js
+60
-0
index.vue
...-agecal-web/src/views/palletDeviceUploadHistory/index.vue
+493
-0
No files found.
zhmes-agecal-admin/src/main/java/com/zehong/web/controller/equipment/PalletDeviceUploadHistoryController.java
0 → 100644
View file @
5223744b
package
com
.
zehong
.
web
.
controller
.
equipment
;
import
com.zehong.common.core.controller.BaseController
;
import
com.zehong.common.core.domain.AjaxResult
;
import
com.zehong.common.core.page.TableDataInfo
;
import
com.zehong.common.utils.poi.ExcelUtil
;
import
com.zehong.system.domain.PalletDeviceUploadHistory
;
import
com.zehong.system.service.IPalletDeviceUploadHistoryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 未上传成功的历史数据列Controller
*
* @author zehong
* @date 2025-11-24
*/
@RestController
@RequestMapping
(
"/palletDevice/binding/history"
)
public
class
PalletDeviceUploadHistoryController
extends
BaseController
{
@Autowired
private
IPalletDeviceUploadHistoryService
palletDeviceUploadHistoryService
;
/**
* 查询未上传成功的历史数据列列表
*/
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
)
{
startPage
();
List
<
PalletDeviceUploadHistory
>
list
=
palletDeviceUploadHistoryService
.
selectPalletDeviceUploadHistoryList
(
palletDeviceUploadHistory
);
return
getDataTable
(
list
);
}
/**
* 导出未上传成功的历史数据列列表
*/
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
)
{
List
<
PalletDeviceUploadHistory
>
list
=
palletDeviceUploadHistoryService
.
selectPalletDeviceUploadHistoryList
(
palletDeviceUploadHistory
);
ExcelUtil
<
PalletDeviceUploadHistory
>
util
=
new
ExcelUtil
<
PalletDeviceUploadHistory
>(
PalletDeviceUploadHistory
.
class
);
return
util
.
exportExcel
(
list
,
"未上传成功的历史数据列数据"
);
}
/**
* 获取未上传成功的历史数据列详细信息
*/
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
palletDeviceUploadHistoryService
.
selectPalletDeviceUploadHistoryById
(
id
));
}
/**
* 新增未上传成功的历史数据列
*/
@PostMapping
public
AjaxResult
add
(
@RequestBody
PalletDeviceUploadHistory
palletDeviceUploadHistory
)
{
return
toAjax
(
palletDeviceUploadHistoryService
.
insertPalletDeviceUploadHistory
(
palletDeviceUploadHistory
));
}
/**
* 重新上传
*/
@GetMapping
(
"/handleReUpload"
)
public
AjaxResult
handleReUpload
(){
return
palletDeviceUploadHistoryService
.
handleReUpload
();
}
/**
* 修改未上传成功的历史数据列
*/
@PutMapping
public
AjaxResult
edit
(
@RequestBody
PalletDeviceUploadHistory
palletDeviceUploadHistory
)
{
return
toAjax
(
palletDeviceUploadHistoryService
.
updatePalletDeviceUploadHistory
(
palletDeviceUploadHistory
));
}
/**
* 删除未上传成功的历史数据列
*/
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
palletDeviceUploadHistoryService
.
deletePalletDeviceUploadHistoryByIds
(
ids
));
}
}
zhmes-agecal-common/src/main/java/com/zehong/common/utils/http/HttpUtils.java
View file @
5223744b
package
com
.
zehong
.
common
.
utils
.
http
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.PrintWriter
;
import
java.net.ConnectException
;
import
java.net.SocketTimeoutException
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.io.*
;
import
java.net.*
;
import
java.nio.charset.StandardCharsets
;
import
java.security.cert.X509Certificate
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.HttpsURLConnection
;
...
...
@@ -108,72 +102,69 @@ public class HttpUtils
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param
p
aram 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @param
jsonP
aram 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public
static
String
sendPost
(
String
url
,
String
param
)
{
PrintWriter
out
=
null
;
public
static
String
sendPost
(
String
url
,
String
jsonParam
)
{
HttpURLConnection
conn
=
null
;
BufferedReader
in
=
null
;
StringBuilder
result
=
new
StringBuilder
();
try
{
String
urlNameString
=
url
;
log
.
info
(
"sendPost - {}"
,
urlNameString
);
URL
realUrl
=
new
URL
(
urlNameString
);
URLConnection
conn
=
realUrl
.
openConnection
();
conn
.
setRequestProperty
(
"accept"
,
"*/*"
);
conn
.
setRequestProperty
(
"connection"
,
"Keep-Alive"
);
conn
.
setRequestProperty
(
"user-agent"
,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"
);
conn
.
setRequestProperty
(
"Accept-Charset"
,
"utf-8"
);
conn
.
setRequestProperty
(
"contentType"
,
"utf-8"
);
try
{
URL
realUrl
=
new
URL
(
url
);
conn
=
(
HttpURLConnection
)
realUrl
.
openConnection
();
// 设置连接参数
conn
.
setRequestMethod
(
"POST"
);
conn
.
setRequestProperty
(
"Content-Type"
,
"application/json; charset=utf-8"
);
conn
.
setRequestProperty
(
"Accept"
,
"application/json"
);
conn
.
setRequestProperty
(
"User-Agent"
,
"Mozilla/5.0"
);
conn
.
setDoOutput
(
true
);
conn
.
setDoInput
(
true
);
out
=
new
PrintWriter
(
conn
.
getOutputStream
()
);
out
.
print
(
param
);
out
.
flush
();
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
"utf-8"
));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
.
append
(
line
);
conn
.
setConnectTimeout
(
5000
);
conn
.
setReadTimeout
(
30000
);
// 发送请求体
try
(
OutputStream
os
=
conn
.
getOutputStream
()
;
OutputStreamWriter
osw
=
new
OutputStreamWriter
(
os
,
StandardCharsets
.
UTF_8
))
{
osw
.
write
(
jsonParam
);
osw
.
flush
(
);
}
log
.
info
(
"recv - {}"
,
result
);
}
catch
(
ConnectException
e
)
{
log
.
error
(
"调用HttpUtils.sendPost ConnectException, url="
+
url
+
",param="
+
param
,
e
);
}
catch
(
SocketTimeoutException
e
)
{
log
.
error
(
"调用HttpUtils.sendPost SocketTimeoutException, url="
+
url
+
",param="
+
param
,
e
);
}
catch
(
IOException
e
)
{
log
.
error
(
"调用HttpUtils.sendPost IOException, url="
+
url
+
",param="
+
param
,
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用HttpsUtil.sendPost Exception, url="
+
url
+
",param="
+
param
,
e
);
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
// 读取响应
int
responseCode
=
conn
.
getResponseCode
();
if
(
responseCode
==
HttpURLConnection
.
HTTP_OK
)
{
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
StandardCharsets
.
UTF_8
));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
.
append
(
line
);
}
if
(
in
!=
null
)
{
}
else
{
// 读取错误流
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getErrorStream
(),
StandardCharsets
.
UTF_8
));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
.
append
(
line
);
}
log
.
error
(
"HTTP error code: {}, response: {}"
,
responseCode
,
result
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"调用HttpUtils.sendPost Exception, url="
+
url
+
",param="
+
jsonParam
,
e
);
throw
new
RuntimeException
(
"HTTP请求失败: "
+
e
.
getMessage
());
}
finally
{
if
(
in
!=
null
)
{
try
{
in
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"关闭输入流异常"
,
e
);
}
}
catch
(
IOException
ex
)
{
log
.
error
(
"调用in.close Exception, url="
+
url
+
",param="
+
param
,
ex
);
if
(
conn
!=
null
)
{
conn
.
disconnect
();
}
}
return
result
.
toString
();
}
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/domain/PalletDeviceUploadHistory.java
0 → 100644
View file @
5223744b
package
com
.
zehong
.
system
.
domain
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.zehong.common.annotation.Excel
;
import
com.zehong.common.core.domain.BaseEntity
;
/**
* 未上传成功的历史数据列对象 t_pallet_device_upload_history
*
* @author zehong
* @date 2025-11-24
*/
public
class
PalletDeviceUploadHistory
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 托盘id */
private
Long
id
;
/** 托盘id */
@Excel
(
name
=
"托盘id"
)
private
Long
trayId
;
/** 托盘编号 */
private
String
trayCode
;
/** 绑定的设备编号 */
@Excel
(
name
=
"绑定的设备编号"
)
private
String
deviceCode
;
/** 行 */
@Excel
(
name
=
"行"
)
private
Integer
row
;
/** 列 */
@Excel
(
name
=
"列"
)
private
Integer
col
;
/** 第几个 */
@Excel
(
name
=
"第几个"
)
private
Integer
index
;
/** 编号 */
@Excel
(
name
=
"编号"
)
private
Integer
number
;
/** 绑定时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"绑定时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
bindingTime
;
/** 解绑时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"解绑时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
unbindingTime
;
/** 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障 */
@Excel
(
name
=
"0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障"
)
private
String
status
;
/** 设置-年 */
@Excel
(
name
=
"设置-年"
)
private
String
recordYear
;
/** 设置-月 */
@Excel
(
name
=
"设置-月"
)
private
String
recordMonth
;
/** 设置-日 */
@Excel
(
name
=
"设置-日"
)
private
String
recordDate
;
/** 设置-时 */
@Excel
(
name
=
"设置-时"
)
private
String
recordHour
;
/** 设置-分 */
@Excel
(
name
=
"设置-分"
)
private
String
recordMinute
;
/** 写入时间状态;0-失败;1-成功 */
@Excel
(
name
=
"写入时间状态;0-失败;1-成功"
)
private
String
writeTimeStatus
;
/** 调零AD */
@Excel
(
name
=
"调零AD"
)
private
String
adjustmentZeroAd
;
/** 合格;不合格 */
@Excel
(
name
=
"合格;不合格"
)
private
String
zeroStatus
;
/** 标定AD */
@Excel
(
name
=
"标定AD"
)
private
String
calibrationAd
;
/** 合格;不合格 */
@Excel
(
name
=
"合格;不合格"
)
private
String
calibrationStatus
;
/** 浓度值 */
@Excel
(
name
=
"浓度值"
)
private
String
concentration
;
/** 写入时间状态;0-失败;1-成功 */
@Excel
(
name
=
"写入时间状态;0-失败;1-成功"
)
private
String
runTimeStatus
;
/** 实时AD值 */
@Excel
(
name
=
"实时AD值"
)
private
Integer
realTimeAd
;
/** 实时AD状态;0-异常;1-正常 */
@Excel
(
name
=
"实时AD状态;0-异常;1-正常"
)
private
String
realTimeAdStatus
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setTrayId
(
Long
trayId
)
{
this
.
trayId
=
trayId
;
}
public
Long
getTrayId
()
{
return
trayId
;
}
public
void
setDeviceCode
(
String
deviceCode
)
{
this
.
deviceCode
=
deviceCode
;
}
public
String
getDeviceCode
()
{
return
deviceCode
;
}
public
void
setRow
(
Integer
row
)
{
this
.
row
=
row
;
}
public
Integer
getRow
()
{
return
row
;
}
public
void
setCol
(
Integer
col
)
{
this
.
col
=
col
;
}
public
Integer
getCol
()
{
return
col
;
}
public
void
setIndex
(
Integer
index
)
{
this
.
index
=
index
;
}
public
Integer
getIndex
()
{
return
index
;
}
public
void
setNumber
(
Integer
number
)
{
this
.
number
=
number
;
}
public
Integer
getNumber
()
{
return
number
;
}
public
void
setBindingTime
(
Date
bindingTime
)
{
this
.
bindingTime
=
bindingTime
;
}
public
Date
getBindingTime
()
{
return
bindingTime
;
}
public
void
setUnbindingTime
(
Date
unbindingTime
)
{
this
.
unbindingTime
=
unbindingTime
;
}
public
Date
getUnbindingTime
()
{
return
unbindingTime
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setRecordYear
(
String
recordYear
)
{
this
.
recordYear
=
recordYear
;
}
public
String
getRecordYear
()
{
return
recordYear
;
}
public
void
setRecordMonth
(
String
recordMonth
)
{
this
.
recordMonth
=
recordMonth
;
}
public
String
getRecordMonth
()
{
return
recordMonth
;
}
public
void
setRecordDate
(
String
recordDate
)
{
this
.
recordDate
=
recordDate
;
}
public
String
getRecordDate
()
{
return
recordDate
;
}
public
void
setRecordHour
(
String
recordHour
)
{
this
.
recordHour
=
recordHour
;
}
public
String
getRecordHour
()
{
return
recordHour
;
}
public
void
setRecordMinute
(
String
recordMinute
)
{
this
.
recordMinute
=
recordMinute
;
}
public
String
getRecordMinute
()
{
return
recordMinute
;
}
public
void
setWriteTimeStatus
(
String
writeTimeStatus
)
{
this
.
writeTimeStatus
=
writeTimeStatus
;
}
public
String
getWriteTimeStatus
()
{
return
writeTimeStatus
;
}
public
void
setAdjustmentZeroAd
(
String
adjustmentZeroAd
)
{
this
.
adjustmentZeroAd
=
adjustmentZeroAd
;
}
public
String
getAdjustmentZeroAd
()
{
return
adjustmentZeroAd
;
}
public
void
setZeroStatus
(
String
zeroStatus
)
{
this
.
zeroStatus
=
zeroStatus
;
}
public
String
getZeroStatus
()
{
return
zeroStatus
;
}
public
void
setCalibrationAd
(
String
calibrationAd
)
{
this
.
calibrationAd
=
calibrationAd
;
}
public
String
getCalibrationAd
()
{
return
calibrationAd
;
}
public
void
setCalibrationStatus
(
String
calibrationStatus
)
{
this
.
calibrationStatus
=
calibrationStatus
;
}
public
String
getCalibrationStatus
()
{
return
calibrationStatus
;
}
public
void
setConcentration
(
String
concentration
)
{
this
.
concentration
=
concentration
;
}
public
String
getConcentration
()
{
return
concentration
;
}
public
void
setRunTimeStatus
(
String
runTimeStatus
)
{
this
.
runTimeStatus
=
runTimeStatus
;
}
public
String
getRunTimeStatus
()
{
return
runTimeStatus
;
}
public
void
setRealTimeAd
(
Integer
realTimeAd
)
{
this
.
realTimeAd
=
realTimeAd
;
}
public
Integer
getRealTimeAd
()
{
return
realTimeAd
;
}
public
void
setRealTimeAdStatus
(
String
realTimeAdStatus
)
{
this
.
realTimeAdStatus
=
realTimeAdStatus
;
}
public
String
getRealTimeAdStatus
()
{
return
realTimeAdStatus
;
}
public
String
getTrayCode
()
{
return
trayCode
;
}
public
void
setTrayCode
(
String
trayCode
)
{
this
.
trayCode
=
trayCode
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"trayId"
,
getTrayId
())
.
append
(
"deviceCode"
,
getDeviceCode
())
.
append
(
"row"
,
getRow
())
.
append
(
"col"
,
getCol
())
.
append
(
"index"
,
getIndex
())
.
append
(
"number"
,
getNumber
())
.
append
(
"bindingTime"
,
getBindingTime
())
.
append
(
"unbindingTime"
,
getUnbindingTime
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"status"
,
getStatus
())
.
append
(
"recordYear"
,
getRecordYear
())
.
append
(
"recordMonth"
,
getRecordMonth
())
.
append
(
"recordDate"
,
getRecordDate
())
.
append
(
"recordHour"
,
getRecordHour
())
.
append
(
"recordMinute"
,
getRecordMinute
())
.
append
(
"writeTimeStatus"
,
getWriteTimeStatus
())
.
append
(
"adjustmentZeroAd"
,
getAdjustmentZeroAd
())
.
append
(
"zeroStatus"
,
getZeroStatus
())
.
append
(
"calibrationAd"
,
getCalibrationAd
())
.
append
(
"calibrationStatus"
,
getCalibrationStatus
())
.
append
(
"concentration"
,
getConcentration
())
.
append
(
"runTimeStatus"
,
getRunTimeStatus
())
.
append
(
"realTimeAd"
,
getRealTimeAd
())
.
append
(
"realTimeAdStatus"
,
getRealTimeAdStatus
())
.
toString
();
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/mapper/PalletDeviceUploadHistoryMapper.java
0 → 100644
View file @
5223744b
package
com
.
zehong
.
system
.
mapper
;
import
java.util.List
;
import
com.zehong.system.domain.PalletDeviceUploadHistory
;
/**
* 未上传成功的历史数据列Mapper接口
*
* @author zehong
* @date 2025-11-24
*/
public
interface
PalletDeviceUploadHistoryMapper
{
/**
* 查询未上传成功的历史数据列
*
* @param id 未上传成功的历史数据列ID
* @return 未上传成功的历史数据列
*/
public
PalletDeviceUploadHistory
selectPalletDeviceUploadHistoryById
(
Long
id
);
/**
* 查询未上传成功的历史数据列列表
*
* @param palletDeviceUploadHistory 未上传成功的历史数据列
* @return 未上传成功的历史数据列集合
*/
public
List
<
PalletDeviceUploadHistory
>
selectPalletDeviceUploadHistoryList
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
);
/**
* 新增未上传成功的历史数据列
*
* @param palletDeviceUploadHistory 未上传成功的历史数据列
* @return 结果
*/
public
int
insertPalletDeviceUploadHistory
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
);
public
int
batchInsert
(
List
<
PalletDeviceUploadHistory
>
list
);
/**
* 修改未上传成功的历史数据列
*
* @param palletDeviceUploadHistory 未上传成功的历史数据列
* @return 结果
*/
public
int
updatePalletDeviceUploadHistory
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
);
/**
* 删除未上传成功的历史数据列
*
* @param id 未上传成功的历史数据列ID
* @return 结果
*/
public
int
deletePalletDeviceUploadHistoryById
(
Long
id
);
/**
* 批量删除未上传成功的历史数据列
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public
int
deletePalletDeviceUploadHistoryByIds
(
Long
[]
ids
);
}
zhmes-agecal-system/src/main/java/com/zehong/system/netty/handler/NettyUdpServerHandler.java
View file @
5223744b
package
com
.
zehong
.
system
.
netty
.
handler
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.common.utils.bean.BeanUtils
;
import
com.zehong.common.utils.http.HttpUtils
;
import
com.zehong.system.domain.MesDeviceDomain
;
import
com.zehong.system.domain.PalletDeviceBinding
;
import
com.zehong.system.domain.PalletDeviceUploadHistory
;
import
com.zehong.system.domain.RobotArmCommand
;
import
com.zehong.system.service.IPalletDeviceBindingService
;
import
com.zehong.system.service.IPalletDeviceUploadHistoryService
;
import
com.zehong.system.service.IRobotArmCommandService
;
import
com.zehong.system.service.ISysConfigService
;
import
com.zehong.system.service.websocket.RobotArmWebSocketHandler
;
...
...
@@ -32,6 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.io.*
;
import
java.util.stream.Collectors
;
/**
* @author lenovo
...
...
@@ -73,6 +78,9 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
@Resource
private
ISysConfigService
sysConfigService
;
@Resource
private
IPalletDeviceUploadHistoryService
palletDeviceUploadHistoryService
;
/**
* 接收UDP消息
*/
...
...
@@ -192,19 +200,15 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
// 1 根据信息拿到点位信息 假如说1L是传过来的
List
<
PalletDeviceBinding
>
palletDeviceBindings
=
initAdAndStatus
(
message
);
// 2 解析数据上传MES 返回是否成功
Boolean
aBoolean
=
initMesDataAndUpload
(
palletDeviceBindings
);
// 3 三次失败后 记录到本系统,之后有时间再手动上传
if
(!
aBoolean
)
{
}
// 2 解析数据上传MES 返回如果失败则记录失败,等下次有时间再上传
initMesDataAndUpload
(
palletDeviceBindings
);
}
/**
* 初始化MES数据并上传
*/
private
Boolean
initMesDataAndUpload
(
List
<
PalletDeviceBinding
>
palletDeviceBindings
)
{
private
void
initMesDataAndUpload
(
List
<
PalletDeviceBinding
>
palletDeviceBindings
)
{
List
<
MesDeviceDomain
>
mesDeviceDomains
=
new
ArrayList
<>();
...
...
@@ -234,17 +238,101 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
String
result
=
HttpUtils
.
sendPost
(
mesUploadAddress
,
JSON
.
toJSONString
(
mesDeviceDomains
));
if
(
StringUtils
.
isBlank
(
result
))
{
return
false
;
}
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
if
(
jsonObject
.
getInteger
(
"code"
)
==
200
)
{
return
true
;
if
(
jsonObject
.
getInteger
(
"code"
)
!=
200
)
{
String
data
=
jsonObject
.
getString
(
"data"
);
if
(
StringUtils
.
isNotBlank
(
data
))
{
processPalletDeviceUploadHistory
(
palletDeviceBindings
,
data
);
}
}
}
return
false
;
}
/**
* 处理托盘设备上传历史数据
*/
private
void
processPalletDeviceUploadHistory
(
List
<
PalletDeviceBinding
>
palletDeviceBindings
,
String
data
){
JSONObject
jsonObject
=
JSON
.
parseObject
(
data
);
if
(!
jsonObject
.
containsKey
(
"failedCodes"
))
{
return
;
}
JSONArray
failedCodes
=
jsonObject
.
getJSONArray
(
"failedCodes"
);
if
(
failedCodes
==
null
||
failedCodes
.
isEmpty
())
{
return
;
}
// 使用Set提高查找效率
Set
<
String
>
failedCodeSet
=
failedCodes
.
stream
()
.
map
(
Object:
:
toString
)
.
collect
(
Collectors
.
toSet
());
List
<
PalletDeviceUploadHistory
>
palletDeviceUploadHistories
=
palletDeviceBindings
.
stream
()
.
filter
(
binding
->
failedCodeSet
.
contains
(
binding
.
getDeviceCode
()))
.
map
(
this
::
convertToUploadHistory
)
.
collect
(
Collectors
.
toList
());
if
(!
palletDeviceUploadHistories
.
isEmpty
())
{
palletDeviceUploadHistoryService
.
batchInsert
(
palletDeviceUploadHistories
);
}
}
/**
* 转换对象
*/
private
PalletDeviceUploadHistory
convertToUploadHistory
(
PalletDeviceBinding
binding
)
{
PalletDeviceUploadHistory
history
=
new
PalletDeviceUploadHistory
();
// 基础信息字段
history
.
setTrayId
(
binding
.
getTrayId
());
history
.
setDeviceCode
(
binding
.
getDeviceCode
());
history
.
setRow
(
binding
.
getRow
());
history
.
setCol
(
binding
.
getCol
());
history
.
setIndex
(
binding
.
getIndex
());
history
.
setNumber
(
binding
.
getNumber
());
history
.
setBindingTime
(
binding
.
getBindingTime
());
history
.
setUnbindingTime
(
binding
.
getUnbindingTime
());
// 状态字段
history
.
setStatus
(
binding
.
getStatus
());
// 时间记录字段
history
.
setRecordYear
(
binding
.
getRecordYear
());
history
.
setRecordMonth
(
binding
.
getRecordMonth
());
history
.
setRecordDate
(
binding
.
getRecordDate
());
history
.
setRecordHour
(
binding
.
getRecordHour
());
history
.
setRecordMinute
(
binding
.
getRecordMinute
());
// 写入状态字段
history
.
setWriteTimeStatus
(
binding
.
getWriteTimeStatus
());
history
.
setRunTimeStatus
(
binding
.
getRunTimeStatus
());
// 调零相关字段
history
.
setAdjustmentZeroAd
(
binding
.
getAdjustmentZeroAd
());
history
.
setZeroStatus
(
binding
.
getZeroStatus
());
// 标定相关字段 - 注意字段名称不同
history
.
setCalibrationAd
(
binding
.
getCalibrationAd
());
history
.
setCalibrationStatus
(
binding
.
getCalibrationAdStatus
());
// 注意:这里字段名不同
// 浓度字段
history
.
setConcentration
(
binding
.
getConcentration
());
// 实时AD相关字段
history
.
setRealTimeAd
(
binding
.
getRealTimeAd
());
history
.
setRealTimeAdStatus
(
binding
.
getRealTimeStatus
());
// 注意:这里字段名不同
// 托盘编号字段 - 注意字段名称不同
history
.
setTrayCode
(
binding
.
getfTrayCode
());
// 注意:这里字段名不同
// 创建时间和更新时间(如果需要)
history
.
setCreateTime
(
binding
.
getCreateTime
());
history
.
setUpdateTime
(
binding
.
getUpdateTime
());
return
history
;
}
/**
* 根据托盘码查询托盘绑定的设备列
*/
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/IPalletDeviceUploadHistoryService.java
0 → 100644
View file @
5223744b
package
com
.
zehong
.
system
.
service
;
import
java.util.List
;
import
com.zehong.common.core.domain.AjaxResult
;
import
com.zehong.system.domain.PalletDeviceUploadHistory
;
/**
* 未上传成功的历史数据列Service接口
*
* @author zehong
* @date 2025-11-24
*/
public
interface
IPalletDeviceUploadHistoryService
{
/**
* 查询未上传成功的历史数据列
*
* @param id 未上传成功的历史数据列ID
* @return 未上传成功的历史数据列
*/
public
PalletDeviceUploadHistory
selectPalletDeviceUploadHistoryById
(
Long
id
);
/**
* 查询未上传成功的历史数据列列表
*
* @param palletDeviceUploadHistory 未上传成功的历史数据列
* @return 未上传成功的历史数据列集合
*/
public
List
<
PalletDeviceUploadHistory
>
selectPalletDeviceUploadHistoryList
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
);
public
int
batchInsert
(
List
<
PalletDeviceUploadHistory
>
palletDeviceUploadHistoryList
);
/**
* 新增未上传成功的历史数据列
*
* @param palletDeviceUploadHistory 未上传成功的历史数据列
* @return 结果
*/
public
int
insertPalletDeviceUploadHistory
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
);
public
AjaxResult
handleReUpload
();
/**
* 修改未上传成功的历史数据列
*
* @param palletDeviceUploadHistory 未上传成功的历史数据列
* @return 结果
*/
public
int
updatePalletDeviceUploadHistory
(
PalletDeviceUploadHistory
palletDeviceUploadHistory
);
/**
* 批量删除未上传成功的历史数据列
*
* @param ids 需要删除的未上传成功的历史数据列ID
* @return 结果
*/
public
int
deletePalletDeviceUploadHistoryByIds
(
Long
[]
ids
);
/**
* 删除未上传成功的历史数据列信息
*
* @param id 未上传成功的历史数据列ID
* @return 结果
*/
public
int
deletePalletDeviceUploadHistoryById
(
Long
id
);
}
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/PalletDeviceUploadHistoryServiceImpl.java
0 → 100644
View file @
5223744b
This diff is collapsed.
Click to expand it.
zhmes-agecal-system/src/main/resources/mapper/system/PalletDeviceUploadHistoryMapper.xml
0 → 100644
View file @
5223744b
This diff is collapsed.
Click to expand it.
zhmes-agecal-web/src/api/palletDeviceBinding/palletDeviceUploadHistory.js
0 → 100644
View file @
5223744b
import
request
from
'@/utils/request'
// 查询未上传成功的历史数据列列表
export
function
listHistory
(
query
)
{
return
request
({
url
:
'/palletDevice/binding/history/list'
,
method
:
'get'
,
params
:
query
})
}
// 查询未上传成功的历史数据列详细
export
function
getHistory
(
id
)
{
return
request
({
url
:
'/palletDevice/binding/history/'
+
id
,
method
:
'get'
})
}
// 新增未上传成功的历史数据列
export
function
addHistory
(
data
)
{
return
request
({
url
:
'/palletDevice/binding/history'
,
method
:
'post'
,
data
:
data
})
}
// 修改未上传成功的历史数据列
export
function
updateHistory
(
data
)
{
return
request
({
url
:
'/palletDevice/binding/history'
,
method
:
'put'
,
data
:
data
})
}
// 删除未上传成功的历史数据列
export
function
delHistory
(
id
)
{
return
request
({
url
:
'/palletDevice/binding/history/'
+
id
,
method
:
'delete'
})
}
// 导出未上传成功的历史数据列
export
function
exportHistory
(
query
)
{
return
request
({
url
:
'/palletDevice/binding/history/export'
,
method
:
'get'
,
params
:
query
})
}
export
function
reUpload
()
{
return
request
({
url
:
'/palletDevice/binding/history/handleReUpload'
,
method
:
'get'
})
}
zhmes-agecal-web/src/views/palletDeviceUploadHistory/index.vue
0 → 100644
View file @
5223744b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment