|
@@ -1,88 +1,42 @@
|
|
|
//条码关联
|
|
|
-import TaskSeqVO from '../viewmodel/process/TaskSeqInfo'
|
|
|
+import ProcessRequest from '../common/util/request/ProcessRequest'
|
|
|
+import promptAction from '@ohos.promptAction'
|
|
|
+import RequestParamModel from '../viewmodel/RequestParamModel'
|
|
|
+import WorkOrderSeq from '../viewmodel/WorkOrderSeq'
|
|
|
+
|
|
|
@CustomDialog
|
|
|
export struct BarcodeAssociationDialog {
|
|
|
private scrollerMaterial: Scroller = new Scroller()
|
|
|
+ // 工单编号
|
|
|
+ workOrderCode: string = ''
|
|
|
//0:序列号排序,1:铭牌号排序 -1:默认
|
|
|
@State currentClick:number = -1
|
|
|
- @State originalBarcodeList: BarcodeInfo[] = [];
|
|
|
- @State BarcodeList: BarcodeInfo[] = [
|
|
|
- {
|
|
|
- streamNumber: "SN20231001-001",
|
|
|
- serialNumber: "",
|
|
|
- nameplateNumber: ""
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231002-002",
|
|
|
- serialNumber: "SR987654321",
|
|
|
- nameplateNumber: "NP-XYZ-2023-002"
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231003-003",
|
|
|
- serialNumber: "SR456789123",
|
|
|
- nameplateNumber: "NP-DEF-2023-003"
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231004-004",
|
|
|
- serialNumber: "SR789123456",
|
|
|
- nameplateNumber: "NP-GHI-2023-004"
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231001-001",
|
|
|
- serialNumber: "",
|
|
|
- nameplateNumber: ""
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231001-001",
|
|
|
- serialNumber: "SN20231006-006",
|
|
|
- nameplateNumber: ""
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231005-005",
|
|
|
- serialNumber: "SR321654987",
|
|
|
- nameplateNumber: "NP-JKL-2023-005"
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231006-006",
|
|
|
- serialNumber: "",
|
|
|
- nameplateNumber: "SN20231006-006"
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231007-007",
|
|
|
- serialNumber: "SR147258369",
|
|
|
- nameplateNumber: "NP-PQR-2023-007"
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231008-008",
|
|
|
- serialNumber: "",
|
|
|
- nameplateNumber: "NP-STU-2023-008"
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231009-009",
|
|
|
- serialNumber: "",
|
|
|
- nameplateNumber: ""
|
|
|
- },
|
|
|
- {
|
|
|
- streamNumber: "SN20231010-010",
|
|
|
- serialNumber: "SR852963741",
|
|
|
- nameplateNumber: ""
|
|
|
- }
|
|
|
- ];
|
|
|
+ // 工单下流转卡号列表
|
|
|
+ @Link seqList: WorkOrderSeq[]
|
|
|
controller: CustomDialogController
|
|
|
- onConfirm: () => void = () => {
|
|
|
+ onConfirm: () => void = async () => {
|
|
|
+ await ProcessRequest.post('/api/v1/plan/seq/bindCode', this.seqList)
|
|
|
+ // 重新刷新
|
|
|
+ this.seqList = await ProcessRequest.post('/api/v1/plan/seq/list', {
|
|
|
+ workOrderCode: this.workOrderCode
|
|
|
+ } as RequestParamModel)
|
|
|
}
|
|
|
|
|
|
//序列号排序,没有的在前面
|
|
|
onSerialNumberClick() {
|
|
|
if (this.currentClick === 0) {
|
|
|
- this.BarcodeList = [...this.originalBarcodeList];
|
|
|
+ this.seqList.sort((a, b) => {
|
|
|
+ const aStream = a.seqNo ?? "";
|
|
|
+ const bStream = b.seqNo ?? "";
|
|
|
+ return aStream.localeCompare(bStream);
|
|
|
+ })
|
|
|
this.currentClick = -1;
|
|
|
} else {
|
|
|
- this.BarcodeList.sort((a, b) => {
|
|
|
- const aSerial = a.serialNumber ?? "";
|
|
|
- const bSerial = b.serialNumber ?? "";
|
|
|
- const aStream = a.streamNumber ?? "";
|
|
|
- const bStream = b.streamNumber ?? "";
|
|
|
+ this.seqList.sort((a, b) => {
|
|
|
+ const aSerial = a.supportingCode ?? "";
|
|
|
+ const bSerial = b.supportingCode ?? "";
|
|
|
+ const aStream = a.seqNo ?? "";
|
|
|
+ const bStream = b.seqNo ?? "";
|
|
|
|
|
|
if (!aSerial && !bSerial) {
|
|
|
return aStream.localeCompare(bStream);
|
|
@@ -91,23 +45,30 @@ export struct BarcodeAssociationDialog {
|
|
|
} else if (!bSerial) {
|
|
|
return 1;
|
|
|
} else {
|
|
|
- return aStream.localeCompare(bStream);
|
|
|
+ return aSerial.localeCompare(bSerial);
|
|
|
}
|
|
|
});
|
|
|
this.currentClick = 0;
|
|
|
+ for (const element of this.seqList) {
|
|
|
+ console.log('hhtest', JSON.stringify(element))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//铭牌号排序,没有的在前面
|
|
|
onNameplateClick() {
|
|
|
if (this.currentClick === 1) {
|
|
|
- this.BarcodeList = [...this.originalBarcodeList];
|
|
|
+ this.seqList.sort((a, b) => {
|
|
|
+ const aStream = a.seqNo ?? "";
|
|
|
+ const bStream = b.seqNo ?? "";
|
|
|
+ return aStream.localeCompare(bStream);
|
|
|
+ })
|
|
|
this.currentClick = -1;
|
|
|
} else {
|
|
|
- this.BarcodeList.sort((a, b) => {
|
|
|
- const aNameplate = a.nameplateNumber ?? "";
|
|
|
- const bNameplate = b.nameplateNumber ?? "";
|
|
|
- const aStream = a.streamNumber ?? "";
|
|
|
- const bStream = b.streamNumber ?? "";
|
|
|
+ this.seqList.sort((a, b) => {
|
|
|
+ const aNameplate = a.nameplateNo ?? "";
|
|
|
+ const bNameplate = b.nameplateNo ?? "";
|
|
|
+ const aStream = a.seqNo ?? "";
|
|
|
+ const bStream = b.seqNo ?? "";
|
|
|
|
|
|
if (!aNameplate && !bNameplate) {
|
|
|
return aStream.localeCompare(bStream);
|
|
@@ -116,15 +77,19 @@ export struct BarcodeAssociationDialog {
|
|
|
} else if (!bNameplate) {
|
|
|
return 1;
|
|
|
} else {
|
|
|
- return aStream.localeCompare(bStream);
|
|
|
+ return aNameplate.localeCompare(bNameplate);
|
|
|
}
|
|
|
});
|
|
|
this.currentClick = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- aboutToAppear(): void {
|
|
|
- this.originalBarcodeList = [...this.BarcodeList];
|
|
|
+ async aboutToAppear() {
|
|
|
+ if (!this.seqList && this.workOrderCode) {
|
|
|
+ this.seqList = await ProcessRequest.post('/api/v1/plan/seq/list', {
|
|
|
+ workOrderCode: this.workOrderCode
|
|
|
+ } as RequestParamModel)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
build() {
|
|
@@ -136,7 +101,7 @@ export struct BarcodeAssociationDialog {
|
|
|
}.height('8%')
|
|
|
.width('100%')
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
-
|
|
|
+ // 表头和排序操作
|
|
|
Row() {
|
|
|
Row(){
|
|
|
Text(`流水号`)
|
|
@@ -179,22 +144,20 @@ export struct BarcodeAssociationDialog {
|
|
|
.justifyContent(FlexAlign.End)
|
|
|
.margin({left:'2%',right:'2%',top:'1%'})
|
|
|
|
|
|
-
|
|
|
-
|
|
|
Divider()
|
|
|
.vertical(false)
|
|
|
.strokeWidth(1)
|
|
|
.color($r('app.color.15FFFFFF'))
|
|
|
.margin({ top: '1%' ,bottom:'2%',left:'2%',right:'2%'})
|
|
|
-
|
|
|
+ // 绑定区
|
|
|
Row(){
|
|
|
Column(){
|
|
|
- List({scroller:this.scrollerMaterial}) {
|
|
|
- ForEach(this.BarcodeList, (item:BarcodeInfo) => {
|
|
|
+ List({space: 5, scroller:this.scrollerMaterial}) {
|
|
|
+ ForEach(this.seqList, (item: WorkOrderSeq, index: number) => {
|
|
|
ListItem() {
|
|
|
Row() {
|
|
|
Row(){
|
|
|
- Text(item.streamNumber)
|
|
|
+ Text(item.seqNo)
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
}
|
|
@@ -206,11 +169,15 @@ export struct BarcodeAssociationDialog {
|
|
|
.height($r('app.float.virtualSize_24'))
|
|
|
.fillColor($r('app.color.FFFFFF'))
|
|
|
.margin({left:'4%'})
|
|
|
- TextInput({text:item.serialNumber,placeholder:item.serialNumber})
|
|
|
+ TextInput({text: item.supportingCode, placeholder: item.supportingCode})
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
+ .enableKeyboardOnFocus(false)
|
|
|
.width('90%')
|
|
|
.textAlign(TextAlign.Start)
|
|
|
+ .onChange((value: string) =>{
|
|
|
+ item.supportingCode = value
|
|
|
+ })
|
|
|
}
|
|
|
.backgroundColor($r('app.color.000000'))
|
|
|
.borderRadius($r('app.float.virtualSize_16'))
|
|
@@ -223,11 +190,15 @@ export struct BarcodeAssociationDialog {
|
|
|
.height($r('app.float.virtualSize_24'))
|
|
|
.fillColor($r('app.color.FFFFFF'))
|
|
|
.margin({left:'4%'})
|
|
|
- TextInput({text:item.nameplateNumber,placeholder:item.nameplateNumber})
|
|
|
+ TextInput({text: item.nameplateNo, placeholder: item.nameplateNo})
|
|
|
.fontSize($r('app.float.fontSize_16'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
+ .enableKeyboardOnFocus(false)
|
|
|
.width('90%')
|
|
|
.textAlign(TextAlign.Start)
|
|
|
+ .onChange((value: string) =>{
|
|
|
+ item.nameplateNo = value
|
|
|
+ })
|
|
|
}
|
|
|
.backgroundColor($r('app.color.000000'))
|
|
|
.borderRadius($r('app.float.virtualSize_16'))
|
|
@@ -294,10 +265,4 @@ export struct BarcodeAssociationDialog {
|
|
|
.borderWidth(1)
|
|
|
.borderRadius($r('app.float.virtualSize_16'))
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-interface BarcodeInfo{
|
|
|
- streamNumber?:string,
|
|
|
- serialNumber?:string,
|
|
|
- nameplateNumber?:string,
|
|
|
}
|