|
|
@@ -1,6 +1,7 @@
|
|
|
package com.grkj.data.repository.impl.standard
|
|
|
|
|
|
import com.grkj.data.dao.ExceptionDao
|
|
|
+import com.grkj.data.dao.HardwareDao
|
|
|
import com.grkj.data.dao.JobTicketDao
|
|
|
import com.grkj.data.enums.CommonDictDataEnum
|
|
|
import com.grkj.data.enums.JobTicketStatusEnum
|
|
|
@@ -20,7 +21,8 @@ import javax.inject.Singleton
|
|
|
@Singleton
|
|
|
class ExceptionRepository @Inject constructor(
|
|
|
val exceptionDao: ExceptionDao,
|
|
|
- val jobTicketDao: JobTicketDao
|
|
|
+ val jobTicketDao: JobTicketDao,
|
|
|
+ val hardwareDao: HardwareDao
|
|
|
) : BaseRepository(),
|
|
|
IExceptionRepository {
|
|
|
override fun cancelException(exceptionData: List<IsExceptionStandardVo>) {
|
|
|
@@ -29,13 +31,45 @@ class ExceptionRepository @Inject constructor(
|
|
|
CommonDictDataEnum.EXCEPTION_STATUS.commonDictRes.find { it.dictLabel == "已取消" }?.dictValue?.toInt()
|
|
|
}
|
|
|
exceptionData.flatMap { it.sourceData }
|
|
|
- .filter { it.sourceDataType == CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "作业" }?.dictValue?.toInt() }
|
|
|
- .forEach {
|
|
|
- jobTicketDao.updateJobTicketExceptionData(
|
|
|
- it.sourceDataId,
|
|
|
- JobTicketStatusEnum.CANCELED.status,
|
|
|
- CommonDictDataEnum.EXCEPTION_STATUS.commonDictRes.find { it.dictLabel == "已取消" }?.dictValue?.toInt()
|
|
|
- )
|
|
|
+ .forEach { exceptionSource ->
|
|
|
+ when (exceptionSource.sourceDataType) {
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "钥匙" }?.dictValue?.toInt() -> {
|
|
|
+ val keyInfo = hardwareDao.getKeyInfoById(exceptionSource.sourceDataId)
|
|
|
+ keyInfo?.exStatus = null
|
|
|
+ keyInfo?.remark = null
|
|
|
+ keyInfo?.let {
|
|
|
+ hardwareDao.updateKeyInfo(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "挂锁" }?.dictValue?.toInt() -> {
|
|
|
+ val lockInfo =
|
|
|
+ hardwareDao.getLockInfoById(exceptionSource.sourceDataId)
|
|
|
+ lockInfo?.exStatus = null
|
|
|
+ lockInfo?.remark = null
|
|
|
+ lockInfo?.let {
|
|
|
+ hardwareDao.updateLockInfo(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "仓位" }?.dictValue?.toInt() -> {
|
|
|
+ val slotsInfo =
|
|
|
+ hardwareDao.getIsLockCabinetSlotBySlotId(exceptionSource.sourceDataId)
|
|
|
+ slotsInfo?.status = null
|
|
|
+ slotsInfo?.remark = null
|
|
|
+ slotsInfo?.let {
|
|
|
+ hardwareDao.updateSlotsInfo(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "作业" }?.dictValue?.toInt() -> {
|
|
|
+ jobTicketDao.updateJobTicketExceptionData(
|
|
|
+ exceptionSource.sourceDataId,
|
|
|
+ JobTicketStatusEnum.CANCELED.status,
|
|
|
+ CommonDictDataEnum.EXCEPTION_STATUS.commonDictRes.find { it.dictLabel == "已取消" }?.dictValue?.toInt()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
val isExceptionData =
|
|
|
BeanUtils.copyList(exceptionData, IsExceptionStandard::class.java)?.filterNotNull()
|
|
|
@@ -57,13 +91,45 @@ class ExceptionRepository @Inject constructor(
|
|
|
CommonDictDataEnum.EXCEPTION_STATUS.commonDictRes.find { it.dictLabel == "已处理" }?.dictValue?.toInt()
|
|
|
}
|
|
|
exceptionData.flatMap { it.sourceData }
|
|
|
- .filter { it.sourceDataType == CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "作业" }?.dictValue?.toInt() }
|
|
|
- .forEach {
|
|
|
- jobTicketDao.updateJobTicketExceptionData(
|
|
|
- it.sourceDataId,
|
|
|
- JobTicketStatusEnum.FINISHED.status,
|
|
|
- CommonDictDataEnum.EXCEPTION_STATUS.commonDictRes.find { it.dictLabel == "已处理" }?.dictValue?.toInt()
|
|
|
- )
|
|
|
+ .forEach { exceptionSource ->
|
|
|
+ when (exceptionSource.sourceDataType) {
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "钥匙" }?.dictValue?.toInt() -> {
|
|
|
+ val keyInfo = hardwareDao.getKeyInfoById(exceptionSource.sourceDataId)
|
|
|
+ keyInfo?.exStatus = null
|
|
|
+ keyInfo?.remark = null
|
|
|
+ keyInfo?.let {
|
|
|
+ hardwareDao.updateKeyInfo(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "挂锁" }?.dictValue?.toInt() -> {
|
|
|
+ val lockInfo =
|
|
|
+ hardwareDao.getLockInfoById(exceptionSource.sourceDataId)
|
|
|
+ lockInfo?.exStatus = null
|
|
|
+ lockInfo?.remark = null
|
|
|
+ lockInfo?.let {
|
|
|
+ hardwareDao.updateLockInfo(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "仓位" }?.dictValue?.toInt() -> {
|
|
|
+ val slotsInfo =
|
|
|
+ hardwareDao.getIsLockCabinetSlotBySlotId(exceptionSource.sourceDataId)
|
|
|
+ slotsInfo?.status = null
|
|
|
+ slotsInfo?.remark = null
|
|
|
+ slotsInfo?.let {
|
|
|
+ hardwareDao.updateSlotsInfo(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonDictDataEnum.EXCEPTION_SOURCE_TYPE.commonDictRes.find { it.dictLabel == "作业" }?.dictValue?.toInt() -> {
|
|
|
+ jobTicketDao.updateJobTicketExceptionData(
|
|
|
+ exceptionSource.sourceDataId,
|
|
|
+ JobTicketStatusEnum.FINISHED.status,
|
|
|
+ CommonDictDataEnum.EXCEPTION_STATUS.commonDictRes.find { it.dictLabel == "已处理" }?.dictValue?.toInt()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
val isExceptionData =
|
|
|
BeanUtils.copyList(exceptionData, IsExceptionStandard::class.java)?.filterNotNull()
|