|
@@ -6,13 +6,14 @@ import ProcessRequest from '../common/util/request/ProcessRequest';
|
|
|
import RequestParamModel from '../viewmodel/RequestParamModel';
|
|
|
import OperationInfo from '../viewmodel/process/OperationInfo';
|
|
|
import { SelectOrderDialog } from '../view/SelectOrderDialog';
|
|
|
-import image from '@ohos.multimedia.image';
|
|
|
import { SwitchingProductDialog, taskSeqItem } from '../view/SwitchingProductDialog';
|
|
|
import TaskSeqVO from '../viewmodel/process/TaskSeqInfo';
|
|
|
import promptAction from '@ohos.promptAction';
|
|
|
import { StationInfoDialog } from '../view/StationInfoDialog';
|
|
|
import { SwitchingDeptDialog, SwitchingProductLineDialog, SwitchingStationDialog } from '../view/SwitchingStationViews';
|
|
|
import { SwitchingUserDialog } from '../view/SwitchingUserDialog';
|
|
|
+import OperationComponent from '../viewmodel/process/OperationComponent';
|
|
|
+import ProcessInfo from '../viewmodel/process/ProcessInfo';
|
|
|
|
|
|
@Entry
|
|
|
@Component
|
|
@@ -26,13 +27,90 @@ struct ProcessIndex {
|
|
|
// 扫描或手动输入的流水/序列/铭牌号
|
|
|
@State scanCode: string = ''
|
|
|
// 当前流转卡号
|
|
|
- @State seqNo: string = ''
|
|
|
+ @State seqNo: string = '1'
|
|
|
// 选中工序id
|
|
|
- @State selectOperationId: string = ''
|
|
|
+ @State selectOperationId: string = '1'
|
|
|
//选择的按钮索引(默认加载全部)
|
|
|
@State selectedButtonIndex: number = 0
|
|
|
// 流转卡号信息集合
|
|
|
@State taskSeqArray: TaskSeqVO[] = []
|
|
|
+ // 工序组件(工步)
|
|
|
+ @State opComponents: OperationComponent[] = [
|
|
|
+ {
|
|
|
+ compentName:'物料采集',
|
|
|
+ compentType: '1',
|
|
|
+ deleted:0,
|
|
|
+ id:2415,
|
|
|
+ operationId:'679',
|
|
|
+ processRouteId:'0',
|
|
|
+ remark:'',
|
|
|
+ sortNum:0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ compentName:'ESOP',
|
|
|
+ compentType:'4',
|
|
|
+ deleted:0,
|
|
|
+ id:2416,
|
|
|
+ operationId:'679',
|
|
|
+ processRouteId:'0',
|
|
|
+ remark:'',
|
|
|
+ sortNum:1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ compentName:'多媒体采集',
|
|
|
+ compentType:'3',
|
|
|
+ deleted:0,
|
|
|
+ id:2417,
|
|
|
+ operationId:'679',
|
|
|
+ processRouteId:'0',
|
|
|
+ remark:'',
|
|
|
+ sortNum:2,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ compentName:'记录项',
|
|
|
+ compentType:'2',
|
|
|
+ deleted:0,
|
|
|
+ id:2418,
|
|
|
+ operationId:'679',
|
|
|
+ processRouteId:'0',
|
|
|
+ remark:'',
|
|
|
+ sortNum:3,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ compentName:'设备记录',
|
|
|
+ compentType:'6',
|
|
|
+ deleted:0,
|
|
|
+ id:2420,
|
|
|
+ operationId:'679',
|
|
|
+ processRouteId:'0',
|
|
|
+ remark:'',
|
|
|
+ sortNum:5
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ // 选中的工序组件类型
|
|
|
+ @State selectComponentType: string = ''
|
|
|
+ // 工序组件状态数组(0:未完成)
|
|
|
+ @State componentStates: number[] = []
|
|
|
+ // 工序组件对应的图标
|
|
|
+ componentResMap: Map<string, Resource> = new Map([
|
|
|
+ ['1', $r('app.media.process_component_material_collect')],
|
|
|
+ ['2', $r('app.media.process_component_record_item')],
|
|
|
+ ['3', $r('app.media.process_component_multi_media_collect')],
|
|
|
+ ['4', $r('app.media.process_component_esop')],
|
|
|
+ ['6', $r('app.media.process_component_device_record')],
|
|
|
+ ['7', $r('app.media.process_component_fastening')],
|
|
|
+ ['9', $r('app.media.process_component_label_bind')],
|
|
|
+ ['10', $r('app.media.process_component_visual_inspect')],
|
|
|
+ ])
|
|
|
+ @State selectOpComponent: number = 0
|
|
|
+ // 扫码开工后的生产过程信息
|
|
|
+ @State process: ProcessInfo = {}
|
|
|
+ // 扫码开工状态(0:未开工 1:已开工)
|
|
|
+ scanState: number = 0
|
|
|
+
|
|
|
+
|
|
|
+ private scrollerList: Scroller = new Scroller()
|
|
|
+
|
|
|
@State currentDept:string = ''
|
|
|
@State currentProductLine:string = ''
|
|
|
@State currentStation:string = ''
|
|
@@ -48,10 +126,6 @@ struct ProcessIndex {
|
|
|
maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
|
|
|
})
|
|
|
|
|
|
- private scrollerList: Scroller = new Scroller()
|
|
|
- pageNo: number = 1
|
|
|
- pageSize: number = 9
|
|
|
-
|
|
|
StationInfoController: CustomDialogController = new CustomDialogController({
|
|
|
builder: StationInfoDialog({
|
|
|
currentDept:this.currentDept,
|
|
@@ -366,100 +440,155 @@ struct ProcessIndex {
|
|
|
.width('19.8%')
|
|
|
.justifyContent(FlexAlign.SpaceBetween)
|
|
|
// 右侧生产操作栏
|
|
|
- Column() {
|
|
|
- Row() {
|
|
|
- Text('录入流水号')
|
|
|
- .fontSize($r('app.float.fontSize_30'))
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontColor($r('app.color.FFFFFF'))
|
|
|
- }
|
|
|
- .height('10%')
|
|
|
- .width('97.2%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
- Row() {
|
|
|
- Column({space: 8}) {
|
|
|
- Row() {
|
|
|
- this.buildButton(0, '全部', () => this.handleAllClick())
|
|
|
- this.buildButton(1, '已报工', () => this.handleReportedClick())
|
|
|
- this.buildButton(2, '未报工', () => this.handleUnreportedClick())
|
|
|
- }
|
|
|
- .width('72%')
|
|
|
- .height('5.3%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
+ if (this.opComponents.length <= 0) {
|
|
|
+ // 没有工序组件则展示扫码页面
|
|
|
+ Column() {
|
|
|
+ Row() {
|
|
|
+ Text('录入流水号')
|
|
|
+ .fontSize($r('app.float.fontSize_30'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ }
|
|
|
+ .height('10%')
|
|
|
+ .width('97.2%')
|
|
|
+ .justifyContent(FlexAlign.Start)
|
|
|
+ Row() {
|
|
|
+ Column({space: 8}) {
|
|
|
+ Row() {
|
|
|
+ this.buildButton(0, '全部', () => this.handleAllClick())
|
|
|
+ this.buildButton(1, '已报工', () => this.handleReportedClick())
|
|
|
+ this.buildButton(2, '未报工', () => this.handleUnreportedClick())
|
|
|
+ }
|
|
|
+ .width('72%')
|
|
|
+ .height('5.3%')
|
|
|
+ .justifyContent(FlexAlign.Start)
|
|
|
|
|
|
- List({space: 4, scroller: this.scrollerList}) {
|
|
|
- ForEach(this.taskSeqArray, (item:TaskSeqVO) => {
|
|
|
- ListItem() {
|
|
|
- taskSeqItem({
|
|
|
- item:item,
|
|
|
- scanSeqValue: this.scanCode,
|
|
|
- selectedButtonIndex: this.selectedButtonIndex
|
|
|
+ List({space: 4, scroller: this.scrollerList}) {
|
|
|
+ ForEach(this.taskSeqArray, (item:TaskSeqVO) => {
|
|
|
+ ListItem() {
|
|
|
+ taskSeqItem({
|
|
|
+ item:item,
|
|
|
+ scanSeqValue: this.scanCode,
|
|
|
+ selectedButtonIndex: this.selectedButtonIndex
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('72%')
|
|
|
+ .height('94.7%')
|
|
|
+ }
|
|
|
+ .width('52.9%')
|
|
|
+ .height('100%')
|
|
|
+ .alignItems(HorizontalAlign.End)
|
|
|
+ .padding({right: '2.6%'})
|
|
|
+ Divider()
|
|
|
+ .vertical(true)
|
|
|
+ .color($r('app.color.15FFFFFF'))
|
|
|
+ .height('100%')
|
|
|
+ Column({space: 5}) {
|
|
|
+ Row().height('37%')
|
|
|
+ Row() {
|
|
|
+ Text('扫描流水/序列/铭牌号')
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontWeight(FontWeight.Regular)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ }
|
|
|
+ .width('62%')
|
|
|
+ Row() {
|
|
|
+ Row().width('3.4%')
|
|
|
+ // 左侧二维码图标
|
|
|
+ Image($r('app.media.material_qr_code')) // 请替换为您的二维码图片资源
|
|
|
+ .width($r('app.float.virtualSize_24'))
|
|
|
+ .height($r('app.float.virtualSize_24'))
|
|
|
+ .fillColor($r('app.color.FFFFFF'))
|
|
|
+ // 扫码输入框
|
|
|
+ TextInput({ placeholder: '请扫描物料编码', text: this.scanCode })
|
|
|
+ .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)
|
|
|
+ .onChange((value: string) => {
|
|
|
+ this.scanCode = value
|
|
|
+ })
|
|
|
+ .onSubmit(async () => {
|
|
|
+ this.opComponents = await ProcessRequest.get('/api/v1/op/compent/get/' + this.selectOperationId)
|
|
|
})
|
|
|
+ }
|
|
|
+ .width('65%')
|
|
|
+ .height('6.5%')
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.000000'))
|
|
|
+ .justifyContent(FlexAlign.Start)
|
|
|
+ }
|
|
|
+ .width('52.9%')
|
|
|
+ .height('100%')
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('87.7%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ }
|
|
|
+ .width('79.1%')
|
|
|
+ .height('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .backgroundColor($r('app.color.20FFFFFF'))
|
|
|
+ .borderRadius($r('app.float.fontSize_16'))
|
|
|
+ .opacity(!this.seqNo || !CommonConstants.USER_ID || !CommonConstants.STATION_ID ? 0.3 : 1)
|
|
|
+ } else {
|
|
|
+ Column() {
|
|
|
+ Row() {
|
|
|
+ List ({space: 4}) {
|
|
|
+ ForEach(this.opComponents, (item: OperationComponent, index: number) => {
|
|
|
+ ListItem() {
|
|
|
+ Column() {
|
|
|
+ Stack() {
|
|
|
+ Image(this.selectComponentType === item.compentType! ? $r('app.media.process_component_state_select') : (this.componentStates.length >= (index + 1) && this.componentStates[index] === 1 ? $r('app.media.process_component_state_finish') : $r('app.media.process_component_state_no_select')))
|
|
|
+ .height(this.selectComponentType === item.compentType! ? '100%' : '90%')
|
|
|
+ .width('100%')
|
|
|
+ .objectFit(ImageFit.Fill)
|
|
|
+ .borderRadius($r('app.float.fontSize_16'))
|
|
|
+ Column({space: 2}) {
|
|
|
+ Image(this.componentResMap.get(item.compentType!))
|
|
|
+ .height($r('app.float.virtualSize_24'))
|
|
|
+ .width($r('app.float.virtualSize_24'))
|
|
|
+ Text(item.compentName!)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontWeight(FontWeight.Regular)
|
|
|
+ .fontColor($r('app.color.90000000'))
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('90%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('100%')
|
|
|
+ .alignContent(Alignment.Top)
|
|
|
+ .onClick(()=>{
|
|
|
+ this.selectComponentType = item.compentType!
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .height('100%')
|
|
|
+ .width('12.5%')
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- .width('72%')
|
|
|
- .height('94.7%')
|
|
|
- }
|
|
|
- .width('52.9%')
|
|
|
- .height('100%')
|
|
|
- .alignItems(HorizontalAlign.End)
|
|
|
- .padding({right: '2.6%'})
|
|
|
- Divider()
|
|
|
- .vertical(true)
|
|
|
- .color($r('app.color.15FFFFFF'))
|
|
|
+ .listDirection(Axis.Horizontal)
|
|
|
+ .width('100%')
|
|
|
.height('100%')
|
|
|
+ }
|
|
|
+ .height('9.3%')
|
|
|
+ .width('79.1%')
|
|
|
+ Column() {
|
|
|
|
|
|
- Column({space: 5}) {
|
|
|
- Row().height('37%')
|
|
|
- Row() {
|
|
|
- Text('扫描流水/序列/铭牌号')
|
|
|
- .fontSize($r('app.float.fontSize_16'))
|
|
|
- .fontWeight(FontWeight.Regular)
|
|
|
- .fontColor($r('app.color.FFFFFF'))
|
|
|
- }
|
|
|
- .width('62%')
|
|
|
- Row() {
|
|
|
- Row().width('3.4%')
|
|
|
- // 左侧二维码图标
|
|
|
- Image($r('app.media.material_qr_code')) // 请替换为您的二维码图片资源
|
|
|
- .width($r('app.float.virtualSize_24'))
|
|
|
- .height($r('app.float.virtualSize_24'))
|
|
|
- .fillColor($r('app.color.FFFFFF'))
|
|
|
- // 扫码输入框
|
|
|
- TextInput({ placeholder: '请扫描物料编码', text: this.scanCode })
|
|
|
- .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)
|
|
|
- .onChange((value: string) => {
|
|
|
- this.scanCode = value
|
|
|
- })
|
|
|
- .onSubmit(async () => {
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
- .width('65%')
|
|
|
- .height('6.5%')
|
|
|
- .borderRadius($r('app.float.virtualSize_16'))
|
|
|
- .backgroundColor($r('app.color.000000'))
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
}
|
|
|
- .width('52.9%')
|
|
|
- .height('100%')
|
|
|
+ .width('79.1%')
|
|
|
+ .height('90.7%')
|
|
|
+ .backgroundColor($r('app.color.20FFFFFF'))
|
|
|
+ .borderRadius($r('app.float.fontSize_16'))
|
|
|
}
|
|
|
- .width('100%')
|
|
|
- .height('87.7%')
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
+
|
|
|
}
|
|
|
- .width('79.1%')
|
|
|
- .height('100%')
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .backgroundColor($r('app.color.20FFFFFF'))
|
|
|
- .borderRadius($r('app.float.fontSize_16'))
|
|
|
- .opacity(!this.seqNo || !CommonConstants.USER_ID || !CommonConstants.STATION_ID ? 0.3 : 1)
|
|
|
}
|
|
|
.height('80%')
|
|
|
.width('94.8%')
|
|
@@ -586,6 +715,40 @@ struct ProcessIndex {
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.backgroundColor($r('app.color.0A84FF'))
|
|
|
.borderRadius($r('app.float.fontSize_16'))
|
|
|
+ .onClick(async ()=>{
|
|
|
+ if (!this.scanCode || this.scanCode.length <= 0) {
|
|
|
+ promptAction.showToast({
|
|
|
+ message: `请先扫描流水/序列/铭牌号`,
|
|
|
+ duration: 1500,
|
|
|
+ bottom: 100
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.selectOperationId || this.selectOperationId.length <= 0) {
|
|
|
+ promptAction.showToast({
|
|
|
+ message: `请先选择工序`,
|
|
|
+ duration: 1500,
|
|
|
+ bottom: 100
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.process = await ProcessRequest.post('/api/v1/process/info/scan', {
|
|
|
+ operationId: this.selectOperationId,
|
|
|
+ qrCode: this.scanCode,
|
|
|
+ workOrderCode: this.selectWorkOder.workOrderCode!
|
|
|
+ } as RequestParamModel)
|
|
|
+ if (this.process && this.process.id) {
|
|
|
+ this.scanState = 1
|
|
|
+ this.opComponents = await ProcessRequest.get(`/api/v1/process/opCompent/get/${this.selectOperationId!}/${this.process?.id!}`)
|
|
|
+ if (this.opComponents) {
|
|
|
+ for (const element of this.opComponents) {
|
|
|
+ if (CommonConstants.OPERATION_COMPONENT_TYPE.has(element.compentType)) {
|
|
|
+ element.compentType = CommonConstants.OPERATION_COMPONENT_TYPE.get(element.compentType)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
.height('90.6%')
|
|
|
.width('100%')
|