Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
894ead25
Commit
894ead25
authored
Jul 03, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备报废赋码
parent
d9b2f803
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
20 deletions
+84
-20
EquipmentDetailController.java
...oin/equipmanage/controller/EquipmentDetailController.java
+51
-8
EquipmentSpecificSerivceImpl.java
...quipmanage/service/impl/EquipmentSpecificSerivceImpl.java
+20
-0
EquipmentSpecificIndexMapper.xml
...rc/main/resources/mapper/EquipmentSpecificIndexMapper.xml
+13
-12
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentDetailController.java
View file @
894ead25
...
...
@@ -13,18 +13,13 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO
;
import
com.yeejoin.equipmanage.common.enums.EquipQrcodeColorEnum
;
import
com.yeejoin.equipmanage.common.enums.ExcelEnums
;
import
com.yeejoin.equipmanage.common.enums.SourceTypeEnum
;
import
com.yeejoin.equipmanage.common.utils.ExcelUtils
;
import
com.yeejoin.equipmanage.common.utils.NameUtils
;
import
com.yeejoin.equipmanage.common.utils.SpringUtils
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
com.yeejoin.equipmanage.dto.ExcelDto
;
import
com.yeejoin.equipmanage.mapper.EquipmentDetailMapper
;
import
com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper
;
import
com.yeejoin.equipmanage.mapper.ManufacturerInfoMapper
;
import
com.yeejoin.equipmanage.mapper.StockDetailMapper
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl
;
import
com.yeejoin.equipmanage.service.impl.SourcesStatisticsImpl
;
...
...
@@ -51,6 +46,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -98,6 +94,9 @@ public class EquipmentDetailController extends AbstractBaseController {
private
IExcelService
excelService
;
@Autowired
EquipQrcodeRecordMapper
equipQrcodeRecordMapper
;
@Autowired
private
IWarehouseStructureService
warehouseStructureService
;
@Autowired
...
...
@@ -313,8 +312,52 @@ public class EquipmentDetailController extends AbstractBaseController {
}
}
}
//1.更新装备实例Detail数据
EquipmentDetail
equipmentDetail
=
equipmentDate
.
getEquipmentDetail
();
if
(
equipmentDetail
.
getProductionDate
()
!=
null
&&
equipmentDetail
.
getExpiryDate
()!=
null
){
try
{
//设备发生修改后 计算设备报废日期
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
equipmentDetail
.
getProductionDate
()
);
calendar
.
add
(
Calendar
.
YEAR
,
Integer
.
parseInt
(
equipmentDetail
.
getExpiryDate
())
);
Date
now
=
new
Date
();
int
day
=
DateUtils
.
dateBetween
(
now
,
calendar
.
getTime
());
if
(
day
>
-
1
){
//消除设备二维码记录时间
LambdaQueryWrapper
<
EquipQrcodeRecord
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
EquipQrcodeRecord:
:
getEquipid
,
vo
.
getId
());
wrapper
.
eq
(
EquipQrcodeRecord:
:
getSource
,
"scrap"
);
wrapper
.
isNull
(
EquipQrcodeRecord:
:
getCleanTime
);
EquipQrcodeRecord
equipQrcodeRecord
=
equipQrcodeRecordMapper
.
selectOne
(
wrapper
);
if
(!
ObjectUtils
.
isEmpty
(
equipQrcodeRecord
)){
equipQrcodeRecord
.
setCleanTime
(
new
Date
());
equipQrcodeRecord
.
setCleanReason
(
"设备报废日期更新后消除"
);
equipQrcodeRecordMapper
.
updateById
(
equipQrcodeRecord
);
}
//查询二维码事件记录表中该设备的历史数据
LambdaQueryWrapper
<
EquipQrcodeRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
EquipQrcodeRecord:
:
getEquipid
,
vo
.
getId
());
query
.
isNull
(
EquipQrcodeRecord:
:
getCleanTime
);
List
<
EquipQrcodeRecord
>
equipQrcodeRecords
=
equipQrcodeRecordMapper
.
selectList
(
query
);
String
status
=
equipQrcodeRecords
.
stream
().
sorted
(
Comparator
.
comparing
(
EquipQrcodeRecord:
:
getStatus
)).
findFirst
().
get
().
getStatus
();
if
(
equipQrcodeRecords
.
size
()
>
0
)
{
//如果记录表中还存在未消除的其他事件 则按照优先级赋码
equipmentSpecificSerivce
.
updateEquipSpecificStatus
(
status
,
String
.
valueOf
(
vo
.
getId
()));
}
else
{
equipmentSpecificSerivce
.
updateEquipSpecificStatus
(
EquipQrcodeColorEnum
.
GREEN
.
getCode
(),
String
.
valueOf
(
vo
.
getId
()));
}
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
final
EquipmentDetail
dateEquipmentDetail
=
equipmentDate
.
getEquipmentDetail
();
iEquipmentDetailService
.
updateOneById
(
equipmentDate
.
getEquipmentSpecific
().
getId
(),
dateEquipmentDetail
);
//2.更新装备实例主表数据
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java
View file @
894ead25
...
...
@@ -149,6 +149,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value
(
"${equipment.filter.code}"
)
private
String
codes
;
@Autowired
EquipQrcodeRecordMapper
equipQrcodeRecordMapper
;
@Value
(
"${equipment.type}"
)
String
equipmentCategoryLeftTypeCode
;
...
...
@@ -1966,6 +1969,23 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
int
day
=
DateUtils
.
dateBetween
(
now
,
calendar
.
getTime
());
if
(
day
<
Integer
.
parseInt
(
equipmentScrapDay
)
&&
day
>
-
1
)
{
syncSystemctlMsg
(
e
,
scrapTime
,
day
);
}
else
if
(
day
<=
-
1
){
LambdaQueryWrapper
<
EquipQrcodeRecord
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
EquipQrcodeRecord:
:
getEquipid
,
Long
.
valueOf
(
e
.
get
(
"id"
).
toString
()));
wrapper
.
eq
(
EquipQrcodeRecord:
:
getSource
,
"scrap"
);
wrapper
.
isNull
(
EquipQrcodeRecord:
:
getCleanTime
);
EquipQrcodeRecord
equipQrcodeRecord
=
equipQrcodeRecordMapper
.
selectOne
(
wrapper
);
if
(
ObjectUtils
.
isEmpty
(
equipQrcodeRecord
)){
updateEquipSpecificStatus
(
EquipQrcodeColorEnum
.
RED
.
getCode
(),
e
.
get
(
"id"
).
toString
());
EquipQrcodeRecord
newEquipQrcodeRecord
=
new
EquipQrcodeRecord
();
newEquipQrcodeRecord
.
setEquipid
(
Long
.
valueOf
(
e
.
get
(
"id"
).
toString
()));
newEquipQrcodeRecord
.
setSource
(
"scrap"
);
newEquipQrcodeRecord
.
setAlarmTime
(
new
Date
());
newEquipQrcodeRecord
.
setStatus
(
"2"
);
newEquipQrcodeRecord
.
setBizOrgCode
(
e
.
get
(
"bizOrgCode"
).
toString
());
newEquipQrcodeRecord
.
setBizOrgName
(
e
.
get
(
"bizOrgName"
).
toString
());
equipQrcodeRecordMapper
.
insert
(
newEquipQrcodeRecord
);
}
}
}
...
...
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificIndexMapper.xml
View file @
894ead25
...
...
@@ -477,19 +477,20 @@
</select>
<select
id=
"getEquipSpecificScrap"
resultType=
"java.util.Map"
>
select wes.id,
str.name as sname,
wlsd.status,
wes.position,
wes.name,
we.expiry_date as weExpiry,
<!-- wed.expiry_date as wesExpiry,-->
wed.area as area,
wed.production_date as product
str.name as sname,
wlsd.status,
wes.position,
wes.name,
we.expiry_date as weExpiry,
wed.area as area,
wed.production_date as product,
wes.biz_org_code as bizOrgCode,
wes.biz_org_name as bizOrgName
from wl_equipment_specific wes
left join wl_equipment_detail wed on wes.equipment_detail_id = wed.id
left join wl_equipment we on wed.equipment_id = we.id
left join wl_warehouse_structure str on str.id = wes.warehouse_structure_id
left join wl_stock_detail wlsd on wes.id = wlsd.equipment_specific_id
left join wl_equipment_detail wed on wes.equipment_detail_id = wed.id
left join wl_equipment we on wed.equipment_id = we.id
left join wl_warehouse_structure str on str.id = wes.warehouse_structure_id
left join wl_stock_detail wlsd on wes.id = wlsd.equipment_specific_id
where wed.production_date is not null
and wlsd.status != 7
</select>
...
...
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