|
@@ -1,17 +1,28 @@
|
|
|
+import CommonConstants from '../../common/constants/CommonConstants'
|
|
|
+import JGRequest from '../../common/util/request/Request'
|
|
|
+import DictValue from '../../model/DictValue'
|
|
|
+
|
|
|
@Component
|
|
|
export struct EquipRecordView {
|
|
|
|
|
|
private clickTypeName: string = ''
|
|
|
- @State recordArray: EquipCheckRecord[] = [
|
|
|
- {equipName: '高温试验箱001', equipType: 1, checkStandard: '高温:50~100℃ 低温:-5~-10℃ ±1℃', recordCode: 'sds12313213213213231', checkPeriod: '2026-11-11', isExpired:2},
|
|
|
- {equipName: '高温试验箱002', equipType: 1, checkStandard: '高温:50~100℃ 低温:-5~-10℃ ±1℃', recordCode: 'sds123132132132132e3', isExpired:1 },
|
|
|
- {equipName: '高温试验箱003', equipType: 1, checkStandard: '高温:50~100℃ 低温:-5~-10℃ ±1℃', recordCode: 'sds1231321321321cf41', isExpired:1 },
|
|
|
- ]
|
|
|
+ @State equipArray: EquipCheckRecord[] = []
|
|
|
+ selectEquip: number = 0
|
|
|
+
|
|
|
+ // 生产过程id(开工信息id)
|
|
|
+ processId: number = 0
|
|
|
+ // 工序id
|
|
|
+ operationId: number = 0
|
|
|
+
|
|
|
+ dictCode: string = 'device_type'
|
|
|
|
|
|
// 扫描设备弹框
|
|
|
scanEquipController: CustomDialogController = new CustomDialogController({
|
|
|
builder: ScanEquipDialog({
|
|
|
- equipTypeName: this.clickTypeName
|
|
|
+ equipTypeName: this.clickTypeName,
|
|
|
+ processId: this.processId,
|
|
|
+ equipId: this.equipArray[this.selectEquip].id,
|
|
|
+ operationId: this.operationId,
|
|
|
}),
|
|
|
autoCancel: true,
|
|
|
alignment: DialogAlignment.Center,
|
|
@@ -19,10 +30,26 @@ export struct EquipRecordView {
|
|
|
customStyle: true,
|
|
|
})
|
|
|
|
|
|
- aboutToAppear() {
|
|
|
- for (const record of this.recordArray) {
|
|
|
- if (record.equipType === 1) {
|
|
|
- record.equipTypeName = '高低温试验箱'
|
|
|
+ async aboutToAppear() {
|
|
|
+ this.equipArray = await JGRequest.post('/api/v1/process/equit/list', {
|
|
|
+ "operationId": this.operationId,
|
|
|
+ "processId": this.processId
|
|
|
+ })
|
|
|
+ if (this.equipArray && this.equipArray.length > 0) {
|
|
|
+ let dictList: DictValue[] = CommonConstants.DICT_DATA.get(this.dictCode);
|
|
|
+ if (!dictList || dictList.length <= 0) {
|
|
|
+ dictList = await JGRequest.get('/api/v1/sys/dictData/queryByType/' + this.dictCode, {})
|
|
|
+ }
|
|
|
+ // 封装设备类型名称 (数据字典)
|
|
|
+ if (dictList && dictList.length > 0) {
|
|
|
+ for (const equip of this.equipArray) {
|
|
|
+ for (const dict of dictList) {
|
|
|
+ if (equip.equitType === dict.dictValue) {
|
|
|
+ equip.equipTypeName = dict.dictLabel
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -30,11 +57,11 @@ export struct EquipRecordView {
|
|
|
build() {
|
|
|
Column() {
|
|
|
Grid() {
|
|
|
- ForEach(this.recordArray, (item: EquipCheckRecord) => {
|
|
|
+ ForEach(this.equipArray, (item: EquipCheckRecord, index: number) => {
|
|
|
GridItem() {
|
|
|
Column({space: 10}) {
|
|
|
Row() {
|
|
|
- Text(item.equipTypeName)
|
|
|
+ Text(item.equitType)
|
|
|
.fontSize($r('app.float.process_card_middle_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.general_font_opacity'))
|
|
@@ -50,7 +77,7 @@ export struct EquipRecordView {
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
|
|
|
- Text(item.checkStandard)
|
|
|
+ Text(item.accuracy)
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.general_font_opacity'))
|
|
@@ -59,7 +86,7 @@ export struct EquipRecordView {
|
|
|
.width('92%')
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
Row() {
|
|
|
- if (item.isExpired && item.isExpired === 1) {
|
|
|
+ if (!item.equitCode || item.equitCode.length <= 0) {
|
|
|
Text('点击扫描设备')
|
|
|
.fontSize($r('app.float.process_card_middle_font_size'))
|
|
|
.fontColor($r('app.color.general_font_white_color'))
|
|
@@ -68,17 +95,18 @@ export struct EquipRecordView {
|
|
|
.width('100%')
|
|
|
.textAlign(TextAlign.Center)
|
|
|
.onClick(()=> {
|
|
|
- this.clickTypeName = item.equipTypeName
|
|
|
+ this.clickTypeName = item.equitType
|
|
|
+ this.selectEquip = index
|
|
|
this.scanEquipController.open()
|
|
|
})
|
|
|
} else {
|
|
|
Column() {
|
|
|
- Text(item.equipName)
|
|
|
+ Text(item.equitName)
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.general_font_opacity'))
|
|
|
.fontWeight(FontWeight.Medium)
|
|
|
- Text(item.recordCode)
|
|
|
+ Text(item.equitCode)
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
@@ -92,7 +120,7 @@ export struct EquipRecordView {
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.process_step_font_opacity'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
- Text(item.checkPeriod)
|
|
|
+ Text(item.validDate)
|
|
|
.fontSize($r('app.float.process_card_small_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.opacity($r('app.float.general_font_opacity'))
|
|
@@ -105,7 +133,7 @@ export struct EquipRecordView {
|
|
|
.width('93%')
|
|
|
.height('35%')
|
|
|
.borderRadius($r('app.float.general_border_radius'))
|
|
|
- .backgroundColor(item.isExpired === 1 ? $r('app.color.process_card_blue_color') : $r('app.color.process_card_grey_color'))
|
|
|
+ .backgroundColor((!item.equitCode || item.equitCode.length <= 0) ? $r('app.color.process_card_blue_color') : $r('app.color.process_card_grey_color'))
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
}
|
|
|
.width('96%')
|
|
@@ -129,6 +157,14 @@ export struct EquipRecordView {
|
|
|
@CustomDialog
|
|
|
struct ScanEquipDialog {
|
|
|
private equipTypeName: string
|
|
|
+
|
|
|
+ // 生产过程id(开工信息id)
|
|
|
+ processId: number
|
|
|
+ // 工序id
|
|
|
+ operationId: number
|
|
|
+ equipId: string
|
|
|
+ @State equipCode: string = ''
|
|
|
+
|
|
|
controller?: CustomDialogController
|
|
|
cancel: () => void = () => {}
|
|
|
confirm: () => void = () => {}
|
|
@@ -161,7 +197,7 @@ struct ScanEquipDialog {
|
|
|
.width('8%')
|
|
|
.justifyContent(FlexAlign.End)
|
|
|
|
|
|
- TextInput({ placeholder: '请扫描物料编码' })
|
|
|
+ TextInput({ placeholder: '请扫描物料编码', text: this.equipCode })
|
|
|
.placeholderColor($r('app.color.text_input_placeholder_font_color'))
|
|
|
.placeholderFont({size: $r('app.float.robot_set_font_size'), weight: FontWeight.Medium})
|
|
|
.fontSize($r('app.float.robot_set_font_size'))
|
|
@@ -174,10 +210,15 @@ struct ScanEquipDialog {
|
|
|
.borderRadius($r('app.float.robot_set_radius'))
|
|
|
.backgroundColor($r('app.color.general_font_white_color'))
|
|
|
.onChange((value: string) => {
|
|
|
-
|
|
|
+ this.equipCode = value
|
|
|
})
|
|
|
.onSubmit(() => {
|
|
|
-
|
|
|
+ JGRequest.post('/api/v1/process/equit/update', {
|
|
|
+ "equitCode": this.equipCode,
|
|
|
+ "processId": this.processId,
|
|
|
+ "id": this.equipId,
|
|
|
+ "operationId": this.operationId,
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
.height('32%')
|
|
@@ -196,20 +237,45 @@ struct ScanEquipDialog {
|
|
|
}
|
|
|
|
|
|
class EquipCheckRecord {
|
|
|
+ // 创建时间
|
|
|
+ created?: string
|
|
|
+ // 创建人
|
|
|
+ creator?: string
|
|
|
+ // 删除标识
|
|
|
+ deleted?: number
|
|
|
+ // 部门ID
|
|
|
+ deptId?: string
|
|
|
+ // 修改时间
|
|
|
+ updated?: string
|
|
|
+ // 上次修改人
|
|
|
+ updator?: string
|
|
|
+ // 主键
|
|
|
+ id?: string
|
|
|
+ // 精度要求
|
|
|
+ accuracy?: string
|
|
|
+ // 设备编码
|
|
|
+ equitCode?: string
|
|
|
// 设备id
|
|
|
- equipId?: number
|
|
|
- // 设备类型(1:高低温试验箱)
|
|
|
- equipType?: number
|
|
|
- // 设备类型名称
|
|
|
- equipTypeName?: string
|
|
|
+ equitId?: string
|
|
|
// 设备名称
|
|
|
- equipName?: string
|
|
|
- // 检定标准
|
|
|
- checkStandard?: string
|
|
|
- // 记录号
|
|
|
- recordCode?: string
|
|
|
- // 检定有效期
|
|
|
- checkPeriod?: string
|
|
|
- // 1:检查已过期 2:未过期
|
|
|
- isExpired?: number
|
|
|
+ equitName?: string
|
|
|
+ // 设备类型
|
|
|
+ equitType?: string
|
|
|
+ // 订单id
|
|
|
+ orderId?: string
|
|
|
+ // 组织ID
|
|
|
+ orgId?: string
|
|
|
+ // 生产过程id
|
|
|
+ processId?: string
|
|
|
+ // 排序号
|
|
|
+ sortNum?: number
|
|
|
+ // 步骤id
|
|
|
+ stepInstanceId?: string
|
|
|
+ // 设备有效期
|
|
|
+ validDate?: string
|
|
|
+ // 工单id
|
|
|
+ workOrderId?: string
|
|
|
+
|
|
|
+ // 设备类型名称(查询数据字典)
|
|
|
+ equipTypeName?: string
|
|
|
}
|