|
@@ -0,0 +1,150 @@
|
|
|
+import ProcessRequest from '../../common/util/request/ProcessRequest'
|
|
|
+import OperationItem from '../../viewmodel/OperationItem'
|
|
|
+import ProcessInfo from '../../viewmodel/process/ProcessInfo'
|
|
|
+import RequestParamModel from '../../viewmodel/RequestParamModel'
|
|
|
+import WorkOrderInfo from '../../viewmodel/WorkOrderInfo'
|
|
|
+
|
|
|
+@Component
|
|
|
+export struct MaterialCollectView {
|
|
|
+ @State scanCode: string = ''
|
|
|
+ // 需要采集的工序物料
|
|
|
+ @State itemArray: OperationItem[] = []
|
|
|
+ // 总需求数
|
|
|
+ @State needNum: number = 100
|
|
|
+ // 实际数量(已采集数)
|
|
|
+ @State realNum: number = 46
|
|
|
+ // 扫码开工状态(0:未开工 1:已开工)
|
|
|
+ @Link scanState: number
|
|
|
+ // 当前流转卡号
|
|
|
+ @Link seqNo: string
|
|
|
+ // 选中工单
|
|
|
+ @Link selectWorkOder: WorkOrderInfo
|
|
|
+ // 选中工序id
|
|
|
+ @Link selectOperationId: string
|
|
|
+ // 扫码开工后的生产过程信息
|
|
|
+ @Link process: ProcessInfo
|
|
|
+
|
|
|
+ async aboutToAppear() {
|
|
|
+ if (this.scanState === 1) {
|
|
|
+ this.itemArray = await ProcessRequest.post('/api/v1/process/itemRecord/list', {
|
|
|
+ operationId: this.selectOperationId,
|
|
|
+ workOrderCode: this.selectWorkOder.workOrderCode!,
|
|
|
+ seqNo: this.seqNo,
|
|
|
+ processId: this.process.id,
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 999999} as RequestParamModel)
|
|
|
+ } else {
|
|
|
+ this.itemArray = await ProcessRequest.post('/api/v1/op/operationItem/page', {
|
|
|
+ operationId: this.selectOperationId,
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 999999} as RequestParamModel)
|
|
|
+ }
|
|
|
+ for (const element of this.itemArray) {
|
|
|
+ this.needNum += element.needNum!
|
|
|
+ this.realNum += element.realNum!
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ build() {
|
|
|
+ Column() {
|
|
|
+ // 扫码框和已采集统计
|
|
|
+ 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'))
|
|
|
+ .margin({ left: '2%'})
|
|
|
+ // 扫码输入框
|
|
|
+ TextInput({text:this.scanCode, placeholder: '请扫描物料编码' })
|
|
|
+ .type(InputType.Normal)
|
|
|
+ .placeholderFont({ size: $r('app.float.fontSize_16') })
|
|
|
+ .placeholderColor($r('app.color.30FFFFFF'))
|
|
|
+ .fontSize($r('app.float.fontSize_30'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .enableKeyboardOnFocus(false)
|
|
|
+ .onSubmit(() => {
|
|
|
+
|
|
|
+ })
|
|
|
+ .onChange((value: string) => {
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .height('52.8%')
|
|
|
+ .width('28.4%')
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.000000'))
|
|
|
+
|
|
|
+ Column() {
|
|
|
+ Text(this.realNum + '/' + this.needNum)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontWeight(FontWeight.Regular)
|
|
|
+ Progress({ value: this.realNum, total: this.needNum, type: ProgressType.Linear })
|
|
|
+ .width('100%')
|
|
|
+ .color($r('app.color.0A84FF'))
|
|
|
+ .backgroundColor($r('app.color.15FFFFFF'))
|
|
|
+ .borderRadius($r('app.float.virtualSize_32'))
|
|
|
+ }
|
|
|
+ .width('13.1%')
|
|
|
+ .height('31.3%')
|
|
|
+ .alignItems(HorizontalAlign.End)
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ }
|
|
|
+ .height('13.5%')
|
|
|
+ .width('93%')
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ // 动态排列容器
|
|
|
+ Scroll() {
|
|
|
+ Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Column, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Start}) {
|
|
|
+ ForEach(this.itemArray, (item: OperationItem, index: number) => {
|
|
|
+ Column() {
|
|
|
+ Row() {
|
|
|
+ Column() {
|
|
|
+ Text(item.itemName!)
|
|
|
+ .fontSize($r('app.float.fontSize_24'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ Text(item.itemCode!)
|
|
|
+ .fontSize($r('app.float.fontSize_12'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ }
|
|
|
+ .width('45.5%')
|
|
|
+ .height('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ Row() {
|
|
|
+ Image($r('app.media.process_complete_test'))
|
|
|
+ .height('100%')
|
|
|
+ .width('45.5%')
|
|
|
+ }
|
|
|
+ .width('50%')
|
|
|
+ .height('100%')
|
|
|
+ .alignItems(VerticalAlign.Top)
|
|
|
+ }
|
|
|
+ .height('45.8%')
|
|
|
+ .width('100%')
|
|
|
+ .justifyContent(FlexAlign.End)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ .width('32.8%')
|
|
|
+ .height('25.2%')
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.20FFFFFF'))
|
|
|
+ .margin({ top: index > 2 ? '1%' : '0%', left: (index % 3) === 0 ? '0%' : '0.8%' })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ }
|
|
|
+ .scrollable(ScrollDirection.Vertical) // 垂直滚动
|
|
|
+ .scrollBar(BarState.Auto)
|
|
|
+ .width('93%')
|
|
|
+ .height('84%')
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('100%')
|
|
|
+ }
|
|
|
+
|
|
|
+}
|