|
@@ -1,27 +1,89 @@
|
|
|
import ProcessRequest from '../common/util/request/ProcessRequest'
|
|
|
+import TaskSeqVO from '../viewmodel/process/TaskSeqInfo'
|
|
|
import RequestParamModel from '../viewmodel/RequestParamModel'
|
|
|
-import WorkOrderInfo from '../viewmodel/WorkOrderInfo'
|
|
|
-import { WorkOrderPage } from '../viewmodel/WorkOrderPage'
|
|
|
|
|
|
@CustomDialog
|
|
|
export struct SwitchingProductDialog{
|
|
|
- private scrollerMaterial: Scroller = new Scroller()
|
|
|
- //工单列表
|
|
|
- @State workOrderList: WorkOrderInfo[] = []
|
|
|
- //选择的工单索引
|
|
|
- @State selectedOrderIndex: number = -1
|
|
|
- //扫描的工单号
|
|
|
- @State scanOrderValue:string = ''
|
|
|
+ private scrollerList: Scroller = new Scroller()
|
|
|
+ //查询报工
|
|
|
+ @State queryTaskSeq: TaskSeqVO[] = []
|
|
|
+ //当前工单号
|
|
|
+ @State currentWorkOrderCode:string = ''
|
|
|
+ //当前工序号
|
|
|
+ @State currentOperationId:string = ''
|
|
|
+ //当前工位
|
|
|
+ @State currentStationId:string = ''
|
|
|
+ //选择的按钮索引
|
|
|
+ @State selectedButtonIndex: number = 1
|
|
|
+ //扫描的流水号/序列/铭牌号
|
|
|
+ @State scanSeqValue:string = ''
|
|
|
+
|
|
|
controller: CustomDialogController
|
|
|
- onConfirm: () => void = () => {
|
|
|
+ onQueryTask=async (currentStateList:Array<number>)=>{
|
|
|
+ this.queryTaskSeq = await ProcessRequest.post('/api/v1/plan/task/list', {
|
|
|
+ stationId:this.currentStationId,
|
|
|
+ workOrderCode:this.currentWorkOrderCode,
|
|
|
+ operationId:this.currentOperationId,
|
|
|
+ stateList:currentStateList
|
|
|
+ } as RequestParamModel) as TaskSeqVO[];
|
|
|
+ }
|
|
|
+
|
|
|
+ scanStartWork=async ()=> {
|
|
|
+ let res: TaskSeqVO= await ProcessRequest.post('/api/v1/process/info/scan', {
|
|
|
+ stationId:this.currentStationId,
|
|
|
+ workOrderCode:this.currentWorkOrderCode,
|
|
|
+ operationId:this.currentOperationId,
|
|
|
+ qrCode:this.scanSeqValue
|
|
|
+ } as RequestParamModel) as TaskSeqVO;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ handleAllClick():void {
|
|
|
+ this.onQueryTask([])
|
|
|
}
|
|
|
|
|
|
+ handleReportedClick():void{
|
|
|
+ this.onQueryTask([2])
|
|
|
+ }
|
|
|
|
|
|
- private onSelectOrder(index: number) {
|
|
|
- this.selectedOrderIndex = index
|
|
|
+ handleUnreportedClick():void{
|
|
|
+ this.onQueryTask([-1,0,1])
|
|
|
}
|
|
|
|
|
|
aboutToAppear(): void {
|
|
|
+ this.onQueryTask([2])
|
|
|
+ }
|
|
|
+
|
|
|
+ @Builder
|
|
|
+ buildButton(index: number, text: string,onClick: () => void) {
|
|
|
+ Row(){
|
|
|
+ if(this.selectedButtonIndex === index)
|
|
|
+ {
|
|
|
+ Image($r('app.media.process_radio_check'))
|
|
|
+ .width($r('app.float.virtualSize_24'))
|
|
|
+ .height($r('app.float.virtualSize_24'))
|
|
|
+ .fillColor($r('app.color.0A84FF'))
|
|
|
+ }else{
|
|
|
+ Image($r('app.media.process_radio_no_check'))
|
|
|
+ .width($r('app.float.virtualSize_24'))
|
|
|
+ .height($r('app.float.virtualSize_24'))
|
|
|
+ .fillColor($r('app.color.FFFFFF'))
|
|
|
+ }
|
|
|
+ Row(){}.width('10%')
|
|
|
+ Text(text)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .width('31%')
|
|
|
+ .height('100%')
|
|
|
+ .backgroundColor(this.selectedButtonIndex === index ? $r('app.color.200A84FF') : $r('app.color.20FFFFFF')) // 选中蓝/未选中灰
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .margin({ right:'3%'})
|
|
|
+ .onClick(() => {
|
|
|
+ this.selectedButtonIndex = index
|
|
|
+ onClick();
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
build() {
|
|
@@ -47,7 +109,7 @@ export struct SwitchingProductDialog{
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.fontWeight(FontWeight.Lighter)
|
|
|
Row(){
|
|
|
- Text("工单")
|
|
|
+ Text("工单 ")
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.fontWeight(FontWeight.Lighter)
|
|
@@ -87,14 +149,31 @@ export struct SwitchingProductDialog{
|
|
|
.height('10%')
|
|
|
.width('100%')
|
|
|
Row(){
|
|
|
- CallOrderRadioButton()
|
|
|
+ Row() {
|
|
|
+ this.buildButton(0, '全部', () => this.handleAllClick())
|
|
|
+ this.buildButton(1, '已报工', () => this.handleReportedClick())
|
|
|
+ this.buildButton(2, '未报工', () => this.handleUnreportedClick())
|
|
|
+ }.width('100%')
|
|
|
+ .height('55%')
|
|
|
}
|
|
|
.height('10%')
|
|
|
.width('80%')
|
|
|
.margin({right:'20%'})
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
Column(){
|
|
|
-
|
|
|
+ List({space: 8,scroller:this.scrollerList}) {
|
|
|
+ ForEach(this.queryTaskSeq, (item:TaskSeqVO) => {
|
|
|
+ ListItem() {
|
|
|
+ taskSeqItem({
|
|
|
+ item:item,
|
|
|
+ scanSeqValue:this.scanSeqValue,
|
|
|
+ selectedButtonIndex:this.selectedButtonIndex
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('100%')
|
|
|
}
|
|
|
.height('80%')
|
|
|
.width('100%')
|
|
@@ -108,8 +187,40 @@ export struct SwitchingProductDialog{
|
|
|
.color($r('app.color.15FFFFFF'))
|
|
|
.margin({ bottom: '2%'})
|
|
|
Column(){
|
|
|
+ Text("扫描流水/序列/铭牌号")
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .margin({left:'22%'})
|
|
|
+ Row() {
|
|
|
+ // 左侧二维码图标
|
|
|
+ Image($r('app.media.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.scanSeqValue, 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(() => {
|
|
|
|
|
|
+ })
|
|
|
+ .onChange((value: string) => {
|
|
|
+ this.scanSeqValue = value;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .height('6%')
|
|
|
+ .width('60%')
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.000000'))
|
|
|
+ .margin({top:'2%',bottom:'5%',left:'20%'})
|
|
|
}
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
.width('46%')
|
|
|
.height('100%')
|
|
|
}
|
|
@@ -132,7 +243,6 @@ export struct SwitchingProductDialog{
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.width('50%')
|
|
|
.onClick(() => this.controller.close())
|
|
|
-
|
|
|
Divider()
|
|
|
.vertical(true)
|
|
|
.strokeWidth(1)
|
|
@@ -145,8 +255,7 @@ export struct SwitchingProductDialog{
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.width('50%')
|
|
|
.onClick(() => {
|
|
|
- if(this.selectedOrderIndex==-1) return
|
|
|
- this.onConfirm();
|
|
|
+ this.scanStartWork();
|
|
|
this.controller.close();
|
|
|
})
|
|
|
}
|
|
@@ -167,97 +276,47 @@ export struct SwitchingProductDialog{
|
|
|
}
|
|
|
|
|
|
@Component
|
|
|
-struct CallOrderButton{
|
|
|
-
|
|
|
- @State isSelected: boolean = false
|
|
|
- @Prop name:string = ''
|
|
|
-
|
|
|
+struct taskSeqItem{
|
|
|
+ @Prop item: TaskSeqVO
|
|
|
+ @Link scanSeqValue:string
|
|
|
+ @State scaleValue : number = 1
|
|
|
+ @Link selectedButtonIndex:number
|
|
|
build() {
|
|
|
- Row(){
|
|
|
- if(this.isSelected)
|
|
|
- {
|
|
|
- Circle()
|
|
|
- .width($r('app.float.virtualSize_24'))
|
|
|
- .height($r('app.float.virtualSize_24'))
|
|
|
- .fillOpacity(0)
|
|
|
- .strokeWidth(1)
|
|
|
- .stroke($r('app.color.0A84FF'))
|
|
|
- }else{
|
|
|
- Circle()
|
|
|
- .width($r('app.float.virtualSize_24'))
|
|
|
- .height($r('app.float.virtualSize_24'))
|
|
|
- .fillOpacity(0)
|
|
|
- .strokeWidth(1)
|
|
|
- .stroke($r('app.color.FFFFFF'))
|
|
|
- }
|
|
|
- Row(){}.width('10%')
|
|
|
- Text(this.name)
|
|
|
+ Row() {
|
|
|
+ Text('S/N ')
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
-
|
|
|
- }
|
|
|
- .backgroundColor(this.isSelected?$r('app.color.0A84FF'):$r('app.color.20FFFFFF'))
|
|
|
- .width('100%')
|
|
|
- .height('100%')
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .margin({ left:'2%'})
|
|
|
+ Text(this.item.seqNo)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
+ if(this.selectedButtonIndex!=2)
|
|
|
+ {
|
|
|
+ Text(`报工时间:${this.item.updated}`)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontColor($r('app.color.60FFFFFF'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .margin({ left:'35%'})
|
|
|
+ }
|
|
|
+ }.width('100%')
|
|
|
+ .justifyContent(FlexAlign.Start)
|
|
|
+ .backgroundColor($r('app.color.20FFFFFF'))
|
|
|
+ .padding(10)
|
|
|
.borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .scale({ x: this.scaleValue, y: this.scaleValue })
|
|
|
+ .animation({
|
|
|
+ duration: 200,
|
|
|
+ curve: Curve.Linear // 弹性曲线更生动
|
|
|
+ })
|
|
|
.onClick(() => {
|
|
|
- this.isSelected = !this.isSelected
|
|
|
+ this.scaleValue = 0.9; // 点击时缩小
|
|
|
+ setTimeout(() => {
|
|
|
+ this.scanSeqValue = this.item?.seqNo??''
|
|
|
+ this.scaleValue = 1;
|
|
|
+ }, 200);
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-@Component
|
|
|
-struct CallOrderRadioButton {
|
|
|
- @State selectedIndex: number = -1 // 初始未选中
|
|
|
-
|
|
|
- build() {
|
|
|
- Row() {
|
|
|
- // 三个按钮(31%宽度 + 3%间距)
|
|
|
- this.buildButton(0, '选项1')
|
|
|
- this.buildButton(1, '选项2')
|
|
|
- this.buildButton(2, '选项3')
|
|
|
- }
|
|
|
- .width('100%')
|
|
|
- .height('55%')
|
|
|
- }
|
|
|
-
|
|
|
- @Builder
|
|
|
- buildButton(index: number, text: string) {
|
|
|
- Button() {
|
|
|
- Row(){
|
|
|
- if(this.selectedIndex === index)
|
|
|
- {
|
|
|
- Circle()
|
|
|
- .width($r('app.float.virtualSize_24'))
|
|
|
- .height($r('app.float.virtualSize_24'))
|
|
|
- .fillOpacity(0)
|
|
|
- .strokeWidth(1)
|
|
|
- .stroke($r('app.color.0A84FF'))
|
|
|
- }else{
|
|
|
- Circle()
|
|
|
- .width($r('app.float.virtualSize_24'))
|
|
|
- .height($r('app.float.virtualSize_24'))
|
|
|
- .fillOpacity(0)
|
|
|
- .strokeWidth(1)
|
|
|
- .stroke($r('app.color.FFFFFF'))
|
|
|
- }
|
|
|
- Row(){}.width('10%')
|
|
|
- Text(text)
|
|
|
- .fontSize($r('app.float.fontSize_16'))
|
|
|
- .fontColor($r('app.color.FFFFFF'))
|
|
|
- }
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- }
|
|
|
- .width('31%')
|
|
|
- .backgroundColor(this.selectedIndex === index ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF')) // 选中蓝/未选中灰
|
|
|
- .borderRadius(16)
|
|
|
- .margin({ right: index < 2 ? '3%' : 0 }) // 最后一个按钮不加右边距
|
|
|
- .onClick(() => {
|
|
|
- this.selectedIndex = index // 更新选中状态
|
|
|
- })
|
|
|
- }
|
|
|
-}
|