Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zh-mes-device-data-process
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
耿迪迪
zh-mes-device-data-process
Commits
952f17a8
Commit
952f17a8
authored
Jun 10, 2025
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
产品扫码
parent
80e7b759
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
391 additions
and
6 deletions
+391
-6
MesDeviceDataConstant.java
src/main/java/com/zehong/constant/MesDeviceDataConstant.java
+5
-0
ProductDeviceListMapper.java
src/main/java/com/zehong/dao/ProductDeviceListMapper.java
+62
-0
ProductDeviceList.java
src/main/java/com/zehong/entity/ProductDeviceList.java
+178
-0
ProduceScanCodeResultServiceImpl.java
...zehong/service/impl/ProduceScanCodeResultServiceImpl.java
+25
-6
ProductDeviceListMapper.xml
src/main/resources/mapper/ProductDeviceListMapper.xml
+121
-0
No files found.
src/main/java/com/zehong/constant/MesDeviceDataConstant.java
View file @
952f17a8
...
...
@@ -16,4 +16,9 @@ public class MesDeviceDataConstant {
* pcba device key
*/
public
static
final
String
PCBA_DEVICE_KEY
=
"pcba_device_key"
;
/**
* produce device key
*/
public
static
final
String
PRODUCE_DEVICE_KEY
=
"produce_device_key"
;
}
src/main/java/com/zehong/dao/ProductDeviceListMapper.java
0 → 100644
View file @
952f17a8
package
com
.
zehong
.
dao
;
import
com.zehong.entity.ProductDeviceList
;
import
java.util.List
;
/**
* 产品设备列Mapper接口
*
* @author zehong
* @date 2025-06-10
*/
public
interface
ProductDeviceListMapper
{
/**
* 查询产品设备列
*
* @param productDeviceListId 产品设备列ID
* @return 产品设备列
*/
public
ProductDeviceList
selectProductDeviceListById
(
Long
productDeviceListId
);
/**
* 查询产品设备列列表
*
* @param productDeviceList 产品设备列
* @return 产品设备列集合
*/
public
List
<
ProductDeviceList
>
selectProductDeviceListList
(
ProductDeviceList
productDeviceList
);
/**
* 新增产品设备列
*
* @param productDeviceList 产品设备列
* @return 结果
*/
public
int
insertProductDeviceList
(
ProductDeviceList
productDeviceList
);
/**
* 修改产品设备列
*
* @param productDeviceList 产品设备列
* @return 结果
*/
public
int
updateProductDeviceList
(
ProductDeviceList
productDeviceList
);
/**
* 删除产品设备列
*
* @param productDeviceListId 产品设备列ID
* @return 结果
*/
public
int
deleteProductDeviceListById
(
Long
productDeviceListId
);
/**
* 批量删除产品设备列
*
* @param productDeviceListIds 需要删除的数据ID
* @return 结果
*/
public
int
deleteProductDeviceListByIds
(
Long
[]
productDeviceListIds
);
}
src/main/java/com/zehong/entity/ProductDeviceList.java
0 → 100644
View file @
952f17a8
package
com
.
zehong
.
entity
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.util.Date
;
/**
* 产品设备列对象 t_product_device_list
*
* @author zehong
* @date 2025-06-10
*/
public
class
ProductDeviceList
{
/** id */
private
Long
productDeviceListId
;
/** 产品编号(设备号) */
private
String
productNumber
;
/** 产品id */
private
Long
materialInfoId
;
/** 生产任务单号 */
private
String
fProductProductionTasksNumber
;
/** 生产批次号 */
private
String
productBatchNumber
;
/** 报检单编号 */
private
String
inspectionReportNumber
;
/** 箱码 */
private
String
caseCode
;
/** 主板码 */
private
String
motherBoardCode
;
/** NB码 */
private
String
nbCode
;
/** 消防号 */
private
String
fireNumber
;
/** 删除标志(默认0,删除1) */
private
Integer
deleteFlag
;
/** 状态 (NORMAL-正常;REPORT_THE_LOSS_OF-挂失)-新增默认 正常 */
private
String
status
;
/** 质检结果0-合格,1-不合格,2-返工(默认空) */
private
Integer
fItIsQualified
;
/** AOI检测结果 */
private
String
fAoiDetectionResult
;
private
String
remark
;
public
Long
getProductDeviceListId
()
{
return
productDeviceListId
;
}
public
void
setProductDeviceListId
(
Long
productDeviceListId
)
{
this
.
productDeviceListId
=
productDeviceListId
;
}
public
String
getProductNumber
()
{
return
productNumber
;
}
public
void
setProductNumber
(
String
productNumber
)
{
this
.
productNumber
=
productNumber
;
}
public
Long
getMaterialInfoId
()
{
return
materialInfoId
;
}
public
void
setMaterialInfoId
(
Long
materialInfoId
)
{
this
.
materialInfoId
=
materialInfoId
;
}
public
String
getfProductProductionTasksNumber
()
{
return
fProductProductionTasksNumber
;
}
public
void
setfProductProductionTasksNumber
(
String
fProductProductionTasksNumber
)
{
this
.
fProductProductionTasksNumber
=
fProductProductionTasksNumber
;
}
public
String
getProductBatchNumber
()
{
return
productBatchNumber
;
}
public
void
setProductBatchNumber
(
String
productBatchNumber
)
{
this
.
productBatchNumber
=
productBatchNumber
;
}
public
String
getInspectionReportNumber
()
{
return
inspectionReportNumber
;
}
public
void
setInspectionReportNumber
(
String
inspectionReportNumber
)
{
this
.
inspectionReportNumber
=
inspectionReportNumber
;
}
public
String
getCaseCode
()
{
return
caseCode
;
}
public
void
setCaseCode
(
String
caseCode
)
{
this
.
caseCode
=
caseCode
;
}
public
String
getMotherBoardCode
()
{
return
motherBoardCode
;
}
public
void
setMotherBoardCode
(
String
motherBoardCode
)
{
this
.
motherBoardCode
=
motherBoardCode
;
}
public
String
getNbCode
()
{
return
nbCode
;
}
public
void
setNbCode
(
String
nbCode
)
{
this
.
nbCode
=
nbCode
;
}
public
String
getFireNumber
()
{
return
fireNumber
;
}
public
void
setFireNumber
(
String
fireNumber
)
{
this
.
fireNumber
=
fireNumber
;
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
Integer
getfItIsQualified
()
{
return
fItIsQualified
;
}
public
void
setfItIsQualified
(
Integer
fItIsQualified
)
{
this
.
fItIsQualified
=
fItIsQualified
;
}
public
String
getfAoiDetectionResult
()
{
return
fAoiDetectionResult
;
}
public
void
setfAoiDetectionResult
(
String
fAoiDetectionResult
)
{
this
.
fAoiDetectionResult
=
fAoiDetectionResult
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
}
src/main/java/com/zehong/service/impl/ProduceScanCodeResultServiceImpl.java
View file @
952f17a8
package
com
.
zehong
.
service
.
impl
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zehong.constant.MesDeviceDataConstant
;
import
com.zehong.constant.ProduceCodeRules
;
import
com.zehong.dao.ProductDeviceListMapper
;
import
com.zehong.entity.ProductDeviceList
;
import
com.zehong.service.ProduceScanCodeResultService
;
import
com.zehong.utils.RedisCache
;
import
com.zehong.utils.StringUtils
;
...
...
@@ -10,11 +13,8 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -30,6 +30,9 @@ public class ProduceScanCodeResultServiceImpl implements ProduceScanCodeResultSe
@Autowired
private
RedisCache
redisCache
;
@Resource
private
ProductDeviceListMapper
productDeviceListMapper
;
/**
* 产品扫码规则
...
...
@@ -83,7 +86,23 @@ public class ProduceScanCodeResultServiceImpl implements ProduceScanCodeResultSe
* @return int
*/
private
int
addProduceDevice
(
Map
<
String
,
Object
>
result
){
List
<
Map
<
String
,
Object
>>
produceCache
=
redisCache
.
getCacheList
(
MesDeviceDataConstant
.
EQUIPMENT_DOCKING
+
":"
+
MesDeviceDataConstant
.
PRODUCE_DEVICE_KEY
);
if
(!
CollectionUtils
.
isEmpty
(
produceCache
)){
Optional
<
Map
<
String
,
Object
>>
matchDeviceInfo
=
produceCache
.
stream
().
filter
(
item
->
item
.
get
(
"scannerPrefix"
).
equals
(
result
.
get
(
"deviceCode"
))).
findFirst
();
if
(
matchDeviceInfo
.
isPresent
()){
Map
<
String
,
Object
>
currentDeviceInfo
=
matchDeviceInfo
.
get
();
//新增设备信息
ProductDeviceList
productDeviceList
=
new
ProductDeviceList
();
productDeviceList
.
setfProductProductionTasksNumber
((
String
)
currentDeviceInfo
.
get
(
"productProductionTasksNumber"
));
productDeviceList
.
setMaterialInfoId
((
Long
)
currentDeviceInfo
.
get
(
"materialInfoId"
));
List
<
String
>
motherBoardCodes
=
(
List
<
String
>)
result
.
get
(
ProduceCodeRules
.
DEVICECODE
.
name
());
productDeviceList
.
setMotherBoardCode
(
motherBoardCodes
.
get
(
0
));
List
<
String
>
produceNumbers
=
(
List
<
String
>)
result
.
get
(
ProduceCodeRules
.
PRODUCECODE
.
name
());
productDeviceList
.
setProductNumber
(
produceNumbers
.
get
(
0
));
productDeviceList
.
setStatus
(
"NORMAL"
);
return
productDeviceListMapper
.
insertProductDeviceList
(
productDeviceList
);
}
}
return
0
;
}
...
...
src/main/resources/mapper/ProductDeviceListMapper.xml
0 → 100644
View file @
952f17a8
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.zehong.dao.ProductDeviceListMapper"
>
<resultMap
type=
"ProductDeviceList"
id=
"ProductDeviceListResult"
>
<result
property=
"productDeviceListId"
column=
"f_product_device_list_id"
/>
<result
property=
"productNumber"
column=
"f_product_number"
/>
<result
property=
"materialInfoId"
column=
"f_material_info_id"
/>
<result
property=
"fProductProductionTasksNumber"
column=
"f_product_production_tasks_number"
/>
<result
property=
"productBatchNumber"
column=
"f_product_batch_number"
/>
<result
property=
"inspectionReportNumber"
column=
"f_inspection_report_number"
/>
<result
property=
"caseCode"
column=
"f_case_code"
/>
<result
property=
"motherBoardCode"
column=
"f_mother_board_code"
/>
<result
property=
"nbCode"
column=
"f_nb_code"
/>
<result
property=
"fireNumber"
column=
"f_fire_number"
/>
<result
property=
"remark"
column=
"f_remark"
/>
<result
property=
"deleteFlag"
column=
"f_delete_flag"
/>
<result
property=
"status"
column=
"f_status"
/>
<result
property=
"fItIsQualified"
column=
"f_it_is_qualified"
/>
<result
property=
"fAoiDetectionResult"
column=
"f_aoi_detection_result"
/>
</resultMap>
<sql
id=
"selectProductDeviceListVo"
>
select f_product_device_list_id, f_product_number, f_material_info_id, f_product_production_tasks_number, f_product_batch_number, f_inspection_report_number, f_case_code, f_mother_board_code, f_nb_code, f_fire_number, f_remark, f_create_time, f_create_by, f_delete_flag, f_status, f_it_is_qualified, f_aoi_detection_result from t_product_device_list
</sql>
<select
id=
"selectProductDeviceListList"
parameterType=
"ProductDeviceList"
resultMap=
"ProductDeviceListResult"
>
<include
refid=
"selectProductDeviceListVo"
/>
<where>
<if
test=
"productNumber != null and productNumber != ''"
>
and f_product_number = #{productNumber}
</if>
<if
test=
"materialInfoId != null "
>
and f_material_info_id = #{materialInfoId}
</if>
<if
test=
"fProductProductionTasksNumber != null and fProductProductionTasksNumber != ''"
>
and f_product_production_tasks_number = #{fProductProductionTasksNumber}
</if>
<if
test=
"productBatchNumber != null and productBatchNumber != ''"
>
and f_product_batch_number = #{productBatchNumber}
</if>
<if
test=
"inspectionReportNumber != null and inspectionReportNumber != ''"
>
and f_inspection_report_number = #{inspectionReportNumber}
</if>
<if
test=
"caseCode != null and caseCode != ''"
>
and f_case_code = #{caseCode}
</if>
<if
test=
"motherBoardCode != null and motherBoardCode != ''"
>
and f_mother_board_code = #{motherBoardCode}
</if>
<if
test=
"nbCode != null and nbCode != ''"
>
and f_nb_code = #{nbCode}
</if>
<if
test=
"fireNumber != null and fireNumber != ''"
>
and f_fire_number = #{fireNumber}
</if>
<if
test=
"remark != null and remark != ''"
>
and f_remark = #{remark}
</if>
<if
test=
"deleteFlag != null "
>
and f_delete_flag = #{deleteFlag}
</if>
<if
test=
"status != null and status != ''"
>
and f_status = #{status}
</if>
<if
test=
"fItIsQualified != null "
>
and f_it_is_qualified = #{fItIsQualified}
</if>
<if
test=
"fAoiDetectionResult != null and fAoiDetectionResult != ''"
>
and f_aoi_detection_result = #{fAoiDetectionResult}
</if>
</where>
</select>
<select
id=
"selectProductDeviceListById"
parameterType=
"Long"
resultMap=
"ProductDeviceListResult"
>
<include
refid=
"selectProductDeviceListVo"
/>
where f_product_device_list_id = #{productDeviceListId}
</select>
<insert
id=
"insertProductDeviceList"
parameterType=
"ProductDeviceList"
useGeneratedKeys=
"true"
keyProperty=
"productDeviceListId"
>
insert into t_product_device_list
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"productNumber != null and productNumber != ''"
>
f_product_number,
</if>
<if
test=
"materialInfoId != null"
>
f_material_info_id,
</if>
<if
test=
"fProductProductionTasksNumber != null and fProductProductionTasksNumber != ''"
>
f_product_production_tasks_number,
</if>
<if
test=
"productBatchNumber != null"
>
f_product_batch_number,
</if>
<if
test=
"inspectionReportNumber != null and inspectionReportNumber != ''"
>
f_inspection_report_number,
</if>
<if
test=
"caseCode != null and caseCode != ''"
>
f_case_code,
</if>
<if
test=
"motherBoardCode != null and motherBoardCode != ''"
>
f_mother_board_code,
</if>
<if
test=
"nbCode != null and nbCode != ''"
>
f_nb_code,
</if>
<if
test=
"fireNumber != null and fireNumber != ''"
>
f_fire_number,
</if>
<if
test=
"remark != null"
>
f_remark,
</if>
<if
test=
"deleteFlag != null"
>
f_delete_flag,
</if>
<if
test=
"status != null"
>
f_status,
</if>
<if
test=
"fItIsQualified != null"
>
f_it_is_qualified,
</if>
<if
test=
"fAoiDetectionResult != null"
>
f_aoi_detection_result,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"productNumber != null and productNumber != ''"
>
#{productNumber},
</if>
<if
test=
"materialInfoId != null"
>
#{materialInfoId},
</if>
<if
test=
"fProductProductionTasksNumber != null and fProductProductionTasksNumber != ''"
>
#{fProductProductionTasksNumber},
</if>
<if
test=
"productBatchNumber != null"
>
#{productBatchNumber},
</if>
<if
test=
"inspectionReportNumber != null and inspectionReportNumber != ''"
>
#{inspectionReportNumber},
</if>
<if
test=
"caseCode != null and caseCode != ''"
>
#{caseCode},
</if>
<if
test=
"motherBoardCode != null and motherBoardCode != ''"
>
#{motherBoardCode},
</if>
<if
test=
"nbCode != null and nbCode != ''"
>
#{nbCode},
</if>
<if
test=
"fireNumber != null and fireNumber != ''"
>
#{fireNumber},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag},
</if>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"fItIsQualified != null"
>
#{fItIsQualified},
</if>
<if
test=
"fAoiDetectionResult != null"
>
#{fAoiDetectionResult},
</if>
</trim>
</insert>
<update
id=
"updateProductDeviceList"
parameterType=
"ProductDeviceList"
>
update t_product_device_list
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"productNumber != null and productNumber != ''"
>
f_product_number = #{productNumber},
</if>
<if
test=
"materialInfoId != null"
>
f_material_info_id = #{materialInfoId},
</if>
<if
test=
"fProductProductionTasksNumber != null and fProductProductionTasksNumber != ''"
>
f_product_production_tasks_number = #{fProductProductionTasksNumber},
</if>
<if
test=
"productBatchNumber != null"
>
f_product_batch_number = #{productBatchNumber},
</if>
<if
test=
"inspectionReportNumber != null and inspectionReportNumber != ''"
>
f_inspection_report_number = #{inspectionReportNumber},
</if>
<if
test=
"caseCode != null and caseCode != ''"
>
f_case_code = #{caseCode},
</if>
<if
test=
"motherBoardCode != null and motherBoardCode != ''"
>
f_mother_board_code = #{motherBoardCode},
</if>
<if
test=
"nbCode != null and nbCode != ''"
>
f_nb_code = #{nbCode},
</if>
<if
test=
"fireNumber != null and fireNumber != ''"
>
f_fire_number = #{fireNumber},
</if>
<if
test=
"remark != null"
>
f_remark = #{remark},
</if>
<if
test=
"deleteFlag != null"
>
f_delete_flag = #{deleteFlag},
</if>
<if
test=
"status != null"
>
f_status = #{status},
</if>
<if
test=
"fItIsQualified != null"
>
f_it_is_qualified = #{fItIsQualified},
</if>
<if
test=
"fAoiDetectionResult != null"
>
f_aoi_detection_result = #{fAoiDetectionResult},
</if>
</trim>
where f_product_device_list_id = #{productDeviceListId}
</update>
<delete
id=
"deleteProductDeviceListById"
parameterType=
"Long"
>
delete from t_product_device_list where f_product_device_list_id = #{productDeviceListId}
</delete>
<delete
id=
"deleteProductDeviceListByIds"
parameterType=
"String"
>
delete from t_product_device_list where f_product_device_list_id in
<foreach
item=
"productDeviceListId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{productDeviceListId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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