|
@@ -8,6 +8,8 @@ import { AddUnqualifiedRecordDialog } from '../AddUnqualifiedRecordDialog'
|
|
|
import DictValue from '../../viewmodel/DictValue'
|
|
|
import ProcessEscalationFault from '../../viewmodel/process/ProcessEscalationFault'
|
|
|
import ProcessDeviceDailyCheck from '../../viewmodel/process/ProcessDeviceDailyCheck'
|
|
|
+import HashMap from '@ohos.util.HashMap'
|
|
|
+import TimeUtil from '../../common/util/TimeUtil'
|
|
|
|
|
|
// 设备点检工序
|
|
|
@Component
|
|
@@ -15,21 +17,203 @@ export struct DeviceCheckView {
|
|
|
// 设备每日点检
|
|
|
@Link deviceChecks: ProcessDeviceDailyCheck[]
|
|
|
// 扫码开工状态(0:未开工 1:已开工)
|
|
|
- // @Link @Watch('queryByScanState') scanState: number
|
|
|
+ @Link @Watch('queryDeviceCheckByScanState') scanState: number
|
|
|
// 当前流转卡号
|
|
|
@Link seqNo: string
|
|
|
// 选中工序id
|
|
|
@Link selectOperationId: string
|
|
|
// 扫码开工后的生产过程信息
|
|
|
@Link process: ProcessInfo
|
|
|
+ //查找设备编码
|
|
|
+ @State queryDeviceNo: string = 'test000'
|
|
|
+ // 设备类型(key为数据字典值,value为数据字典标签)
|
|
|
+ @State deviceTypes: HashMap<string, string> = new HashMap()
|
|
|
+ // 当前工位IP
|
|
|
+ @Consume('stationIp') stationIp: string
|
|
|
+ deviceTypeDictCode: string = 'device_type'
|
|
|
+ private scrollerDevice: Scroller = new Scroller()
|
|
|
|
|
|
+ // 根据开工状态查询 工序设备点检/工序设备点检历史操作
|
|
|
+ async queryDeviceCheckByScanState() {
|
|
|
+ if (this.scanState === 1) {
|
|
|
+ this.deviceChecks = await ProcessRequest.post('/api/v1/process/deviceCheck/queryAndSave', {
|
|
|
+ stationIp: this.stationIp,
|
|
|
+ processId: this.process.id!,
|
|
|
+ } as RequestParamModel)
|
|
|
+ } else {
|
|
|
+ let result = await ProcessRequest.post('/api/v1/operation/device/page', {
|
|
|
+ operationId: this.selectOperationId,
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 99999
|
|
|
+ } as RequestParamModel) as PageInfo;
|
|
|
+ this.deviceChecks = result.records as ProcessCheck[] || []
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
async aboutToAppear() {
|
|
|
-
|
|
|
+ let deviceDicts: DictValue[] = await ProcessRequest.get(`/api/v1/sys/dictData/queryByType/${this.deviceTypeDictCode}`)
|
|
|
+ if (deviceDicts) {
|
|
|
+ for (const dict of deviceDicts) {
|
|
|
+ this.deviceTypes.set(dict.dictValue!, dict.dictLabel!);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.queryDeviceCheckByScanState()
|
|
|
}
|
|
|
|
|
|
build() {
|
|
|
- Column()
|
|
|
+ Column() {
|
|
|
+ Text("扫描设备 ")
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontSize($r('app.float.fontSize_24'))
|
|
|
+ .height('7.9%')
|
|
|
+ .width('97.2%')
|
|
|
+ Row(){
|
|
|
+ Row() {
|
|
|
+ // 左侧二维码图标
|
|
|
+ Image($r('app.media.material_qr_code'))
|
|
|
+ .width($r('app.float.virtualSize_32'))
|
|
|
+ .height($r('app.float.virtualSize_32'))
|
|
|
+ .fillColor($r('app.color.FFFFFF'))
|
|
|
+ .objectFit(ImageFit.Contain)
|
|
|
+ .margin({left:'0.7%'})
|
|
|
+ // 扫码输入框
|
|
|
+ TextInput({text:this.queryDeviceNo, placeholder: '请扫描设备编码' })
|
|
|
+ .type(InputType.Normal)
|
|
|
+ .placeholderFont({ size: $r('app.float.fontSize_16') })
|
|
|
+ .placeholderColor($r('app.color.30FFFFFF'))
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .enableKeyboardOnFocus(false)
|
|
|
+ .onSubmit(async () => {
|
|
|
+ if (this.deviceChecks) {
|
|
|
+ for (const element of this.deviceChecks) {
|
|
|
+ if (element.deviceNo === this.queryDeviceNo) {
|
|
|
+ promptAction.showToast({
|
|
|
+ message: `设备今日已点检,无需重复点检!`,
|
|
|
+ duration: 1500,
|
|
|
+ bottom: 100
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let check: ProcessDeviceDailyCheck = await ProcessRequest.get(`/api/v1/process/deviceDailyCheck/getServiceLifeByDeviceNo/${this.queryDeviceNo}`)
|
|
|
+ this.deviceChecks.unshift(check)
|
|
|
+ })
|
|
|
+ .onChange((value: string) => {
|
|
|
+ this.queryDeviceNo = value;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .height('100%')
|
|
|
+ .width('27.2%')
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.000000'))
|
|
|
+ Text(TimeUtil.getCurrentDate())
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .margin({left:'3%'})
|
|
|
+ }
|
|
|
+ .height('7.1%')
|
|
|
+ .width('97.2%')
|
|
|
+
|
|
|
+ Column() {
|
|
|
+ List({scroller: this.scrollerDevice }) {
|
|
|
+ ForEach(this.deviceChecks, (item: ProcessDeviceDailyCheck, index) => {
|
|
|
+ ListItem() {
|
|
|
+ Row() {
|
|
|
+ Column(){
|
|
|
+ Text(this.deviceTypes && item.deviceType && this.deviceTypes.hasKey(item.deviceType) ? this.deviceTypes.get(item.deviceType) : '')
|
|
|
+ .fontSize($r('app.float.fontSize_24'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ Text(`名称:${item.deviceName!}`)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .margin({top:'2%',bottom:'1%'})
|
|
|
+ Text(`编码:${item.deviceNo!}`)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ }
|
|
|
+ .width('30%')
|
|
|
+ .height('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
+ .margin({right:'16%'})
|
|
|
+
|
|
|
+ Column({space:5}){
|
|
|
+ Text(`计量有效期:`)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ if (this.scanState === 1) {
|
|
|
+ Row(){
|
|
|
+ Image(item.meteringState! === 1 ? $r('app.media.device_normal') : $r('app.media.device_expire'))
|
|
|
+ .width($r('app.float.virtualSize_24'))
|
|
|
+ .height($r('app.float.virtualSize_24'))
|
|
|
+ .margin({left:'2%'})
|
|
|
+ Text(item.meteringDate ? `${item.meteringDate}` : '长期有效')
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor(item.meteringState! === 1 ? $r('app.color.30D158') : $r('app.color.FF453A'))
|
|
|
+ .margin({left:'2%'})
|
|
|
+ }
|
|
|
+ .width('65%')
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.000000'))
|
|
|
+ .height('25%')
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .width('22%')
|
|
|
+ .height('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
+ Column({space:5}){
|
|
|
+ Text(`维保有效期:`)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ if (this.scanState === 1) {
|
|
|
+ Row() {
|
|
|
+ Image(item.warrantyState! === 1 ? $r('app.media.device_normal') : $r('app.media.device_expire'))
|
|
|
+ .width($r('app.float.virtualSize_24'))
|
|
|
+ .height($r('app.float.virtualSize_24'))
|
|
|
+ .margin({ left: '2%' })
|
|
|
+ Text(item.warrantyPeriod ? `${item.warrantyPeriod}` : '长期有效')
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor(item.warrantyState! === 1 ? $r('app.color.30D158') : $r('app.color.FF453A'))
|
|
|
+ .margin({ left: '2%' })
|
|
|
+ }
|
|
|
+ .width('65%')
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.000000'))
|
|
|
+ .height('25%')
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .width('22%')
|
|
|
+ .height('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
+ }
|
|
|
+ .height('90%')
|
|
|
+ .width('97%')
|
|
|
+ .justifyContent(FlexAlign.Start)
|
|
|
+ }
|
|
|
+ .height('17%')
|
|
|
+ .width('100%')
|
|
|
+ .margin({ bottom: 8})
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.10FFFFFF'))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .height('94%')
|
|
|
+ .width('100%')
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .height('85%')
|
|
|
+ .width('97.2%')
|
|
|
+ }
|
|
|
.width('100%')
|
|
|
.height('100%')
|
|
|
}
|