|
@@ -4,100 +4,31 @@ import StationOperationInfo from '../../viewmodel/wms/StationOperationInfo'
|
|
|
import OperationInfo from '../../viewmodel/wms/OperationInfo'
|
|
|
import RequestParamModel from '../../viewmodel/wms/RequestParamModel'
|
|
|
import WorkOrderInfo from '../../viewmodel/wms/WorkOrderInfo'
|
|
|
+import OperationMaterial from '../../viewmodel/wms/OperationMaterial'
|
|
|
+import OperationItem from '../../viewmodel/wms/OperationItem'
|
|
|
+import HashMap from '@ohos.util.HashMap'
|
|
|
+import DictInfo from '../../viewmodel/DictInfo'
|
|
|
|
|
|
@Component
|
|
|
-export struct ProcessMaterialKitOneStep {
|
|
|
+export struct OperationMaterialKitOneStep {
|
|
|
|
|
|
@Link workOrder: WorkOrderInfo
|
|
|
-
|
|
|
+ @Link selectOperations: OperationInfo[]
|
|
|
+ @Link operationItems: OperationItem[]
|
|
|
+
|
|
|
@State workOrderArray: WorkOrderInfo[] = []
|
|
|
- @State operationArray: StationOperationInfo[] = [
|
|
|
- {
|
|
|
- operationVO: [
|
|
|
- {
|
|
|
- id: '588',
|
|
|
- operationCode: 'XFOP-0052',
|
|
|
- operationName: '领料',
|
|
|
- operationOp: '',
|
|
|
- stanType: '10'
|
|
|
- }
|
|
|
- ],
|
|
|
- stanType: '10',
|
|
|
- stanTypeName: 'tes'
|
|
|
- },
|
|
|
- {
|
|
|
- operationVO: [
|
|
|
- {
|
|
|
- id: '536',
|
|
|
- operationCode: 'XFOP-0015',
|
|
|
- operationName: '装配',
|
|
|
- operationOp: '',
|
|
|
- stanType: '13',
|
|
|
- }
|
|
|
- ],
|
|
|
- stanType: '13'
|
|
|
- },
|
|
|
- {
|
|
|
- operationVO: [
|
|
|
- {
|
|
|
- id: '537',
|
|
|
- operationName: '调试',
|
|
|
- operationOp: '',
|
|
|
- stanType: '7',
|
|
|
- }
|
|
|
- ],
|
|
|
- stanType: '7'
|
|
|
- },
|
|
|
- {
|
|
|
- operationVO: [
|
|
|
- {
|
|
|
- id: '538',
|
|
|
- operationCode: 'XFOP-0017',
|
|
|
- operationName: '装配',
|
|
|
- operationOp: '',
|
|
|
- stanType: '13',
|
|
|
- }
|
|
|
- ],
|
|
|
- stanType: '13'
|
|
|
- },
|
|
|
- {
|
|
|
- operationVO: [
|
|
|
- {
|
|
|
- id: '540',
|
|
|
- operationCode: 'XFOP-0019',
|
|
|
- operationName: '检测',
|
|
|
- operationOp: '',
|
|
|
- stanType: '9',
|
|
|
- },
|
|
|
- {
|
|
|
- id: '539',
|
|
|
- operationCode: 'XFOP-0018',
|
|
|
- operationName: '调试',
|
|
|
- operationOp: '',
|
|
|
- stanType: '9',
|
|
|
- }
|
|
|
- ],
|
|
|
- stanType: '9'
|
|
|
- },
|
|
|
- {
|
|
|
- operationVO: [
|
|
|
- {
|
|
|
- id: '541',
|
|
|
- operationCode: 'XFOP-0020',
|
|
|
- operationName: '试验',
|
|
|
- stanType: '7',
|
|
|
- }
|
|
|
- ],
|
|
|
- stanType: '7'
|
|
|
- }
|
|
|
- ]
|
|
|
-
|
|
|
+ @State operationArray: StationOperationInfo[] = []
|
|
|
+ @State operationMaterialArray: OperationMaterial[] = []
|
|
|
|
|
|
@State selectWorkOrder: number = 0
|
|
|
- @State selectOperations: string[] = []
|
|
|
+ @State selectOperationIds: string[] = []
|
|
|
|
|
|
+ fixed38px: number = 22.8
|
|
|
+ fixed52px: number = 31.2
|
|
|
+ fixed100px: number = 60
|
|
|
|
|
|
- stationType: string = 'station_type'
|
|
|
+ stationTypeDictType: string = 'station_type'
|
|
|
+ stationTypeDictMap: HashMap<string, string> = new HashMap<string, string>()
|
|
|
|
|
|
async aboutToAppear() {
|
|
|
this.workOrderArray = await WmsRequest.post('/api/v1/wms/workOrder/list', {
|
|
@@ -107,42 +38,34 @@ export struct ProcessMaterialKitOneStep {
|
|
|
if (this.workOrderArray && this.workOrderArray.length > 0) {
|
|
|
this.workOrder = this.workOrderArray[0]
|
|
|
this.selectWorkOrder = 0
|
|
|
- console.log('hhtest', '----------' + JSON.stringify(this.workOrderArray[0]))
|
|
|
this.operationArray = await WmsRequest.post('/api/v1/wms/operation/list', {
|
|
|
//查询未完成的工单
|
|
|
processRouteId: this.workOrderArray[0]?.processRouteId,
|
|
|
} as RequestParamModel) as StationOperationInfo[]
|
|
|
}
|
|
|
-
|
|
|
- if (this.operationArray && this.operationArray.length > 0) {
|
|
|
- // 获取不合格原因的数据字典
|
|
|
- let dictArray = CommonConstants.DICT_DATA.get(this.stationType);
|
|
|
- if (!dictArray || dictArray.length <= 0) {
|
|
|
- dictArray = await WmsRequest.get('/api/v1/sys/dictData/queryByType/' + this.stationType as string, {})
|
|
|
- }
|
|
|
- if (!dictArray) {
|
|
|
- return
|
|
|
- }
|
|
|
- for (const element of this.operationArray) {
|
|
|
- for (const dict of dictArray) {
|
|
|
- if (element.stanType === dict.dictValue) {
|
|
|
- element.stanTypeName = dict.dictLabel
|
|
|
+ if (!CommonConstants.DICT_DATA || CommonConstants.DICT_DATA.length <= 0) {
|
|
|
+ let res: DictInfo[] = await WmsRequest.post('/api/v1/sys/dictData/all',)
|
|
|
+ if (res && res.length > 0) {
|
|
|
+ for (const dict of res) {
|
|
|
+ CommonConstants.DICT_DATA.set(dict.dictCode, dict.list)
|
|
|
+ if (this.stationTypeDictType === dict.dictCode) {
|
|
|
+ for (const element of dict?.list!) {
|
|
|
+ this.stationTypeDictMap.set(element.dictValue, element.dictLabel);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ let dictList = CommonConstants.DICT_DATA.get(this.stationTypeDictType);
|
|
|
+ for (const element of dictList) {
|
|
|
+ this.stationTypeDictMap.set(element.dictValue, element.dictLabel);
|
|
|
+ }
|
|
|
}
|
|
|
- console.log('hhtest', '---------------')
|
|
|
- console.log('hhtest', '---------------')
|
|
|
- console.log('hhtest', '---------------')
|
|
|
- console.log('hhtest', '---------------')
|
|
|
- console.log('hhtest', JSON.stringify(this.operationArray))
|
|
|
- console.log('hhtest', '---------------')
|
|
|
- console.log('hhtest', '---------------')
|
|
|
- console.log('hhtest', '---------------')
|
|
|
}
|
|
|
|
|
|
build() {
|
|
|
Row() {
|
|
|
+ // 选择工单
|
|
|
Column() {
|
|
|
Row() {
|
|
|
Text('选择工单')
|
|
@@ -198,6 +121,17 @@ export struct ProcessMaterialKitOneStep {
|
|
|
.borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
.backgroundColor(this.selectWorkOrder === index ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
|
|
|
+ .onClick(async ()=>{
|
|
|
+ if (this.selectWorkOrder === index) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.operationArray = await WmsRequest.post('/api/v1/wms/operation/list', {
|
|
|
+ //查询未完成的工单
|
|
|
+ processRouteId: this.workOrderArray[index]?.processRouteId,
|
|
|
+ } as RequestParamModel) as StationOperationInfo[]
|
|
|
+ this.selectWorkOrder = index
|
|
|
+ this.workOrder = this.workOrderArray[this.selectWorkOrder]
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -210,7 +144,7 @@ export struct ProcessMaterialKitOneStep {
|
|
|
.borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.backgroundColor($r('app.color.10FFFFFF'))
|
|
|
-
|
|
|
+ // 选择工序
|
|
|
Column() {
|
|
|
Row() {
|
|
|
Text('选择工序')
|
|
@@ -228,7 +162,7 @@ export struct ProcessMaterialKitOneStep {
|
|
|
Column() {
|
|
|
Row() {
|
|
|
Row() {
|
|
|
- Text(item.stanTypeName ? item.stanTypeName : (item.stanType ? item.stanType : ''))
|
|
|
+ Text(this.stationTypeDictMap.get(item.stanType!) ? this.stationTypeDictMap.get(item.stanType!) : item.stanType!)
|
|
|
.fontSize($r('app.float.fontSize_6_4'))
|
|
|
.fontWeight(FontWeight.Lighter)
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
@@ -244,21 +178,32 @@ export struct ProcessMaterialKitOneStep {
|
|
|
Row().height(6)
|
|
|
Row({space: 5}) {
|
|
|
Checkbox()
|
|
|
- .select(this.selectOperations.indexOf(operation.id) > -1 ? true : false)
|
|
|
+ .select(this.selectOperationIds.indexOf(operation.id) > -1 ? true : false)
|
|
|
.selectedColor($r('app.color.30D158'))
|
|
|
.width($r('app.float.virtualSize_8'))
|
|
|
.height($r('app.float.virtualSize_8'))
|
|
|
- .onChange((value: boolean) => {
|
|
|
+ .onChange(async (value: boolean) => {
|
|
|
if (value) {
|
|
|
- if (!this.selectOperations.includes(operation.id)) {
|
|
|
- this.selectOperations.push(operation.id)
|
|
|
+ if (!this.selectOperationIds.includes(operation.id)) {
|
|
|
+ this.selectOperationIds.push(operation.id)
|
|
|
+ this.selectOperations.push(operation)
|
|
|
}
|
|
|
} else {
|
|
|
- if (this.selectOperations.includes(operation.id)) {
|
|
|
- this.selectOperations = this.selectOperations.splice(this.selectOperations.indexOf(operation.id), 1)
|
|
|
+ if (this.selectOperationIds.includes(operation.id)) {
|
|
|
+ this.selectOperationIds.splice(this.selectOperationIds.indexOf(operation.id), 1)
|
|
|
+ this.selectOperations.splice(this.selectOperations.indexOf(operation), 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.operationMaterialArray = await WmsRequest.post('/api/v1/wms/operationMaterial/list', {
|
|
|
+ //查询工序需求的物料
|
|
|
+ operationIds: this.selectOperationIds,
|
|
|
+ } as RequestParamModel) as OperationMaterial[]
|
|
|
+ this.operationItems = []
|
|
|
+ if (this.operationMaterialArray) {
|
|
|
+ for (const element of this.operationMaterialArray) {
|
|
|
+ this.operationItems = this.operationItems.concat(element.itemList);
|
|
|
}
|
|
|
}
|
|
|
- console.log('hhtest', '---' + JSON.stringify(this.selectOperations))
|
|
|
})
|
|
|
Text(operation.operationName ? operation.operationName : '')
|
|
|
.fontSize($r('app.float.fontSize_9_6'))
|
|
@@ -268,15 +213,26 @@ export struct ProcessMaterialKitOneStep {
|
|
|
.width('100%')
|
|
|
.height(48)
|
|
|
.padding({left: '6%'})
|
|
|
- .backgroundColor(this.selectOperations.indexOf(operation.id) > -1 ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
|
|
|
+ .backgroundColor(this.selectOperationIds.indexOf(operation.id) > -1 ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
|
|
|
.borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
- .onClick(()=>{
|
|
|
- if (this.selectOperations.includes(operation.id)) {
|
|
|
- this.selectOperations.splice(this.selectOperations.indexOf(operation.id), 1)
|
|
|
+ .onClick(async ()=>{
|
|
|
+ if (this.selectOperationIds.includes(operation.id)) {
|
|
|
+ this.selectOperationIds.splice(this.selectOperationIds.indexOf(operation.id), 1)
|
|
|
+ this.selectOperations.splice(this.selectOperations.indexOf(operation), 1)
|
|
|
} else {
|
|
|
- this.selectOperations.push(operation.id)
|
|
|
+ this.selectOperationIds.push(operation.id)
|
|
|
+ this.selectOperations.push(operation)
|
|
|
+ }
|
|
|
+ this.operationMaterialArray = await WmsRequest.post('/api/v1/wms/operationMaterial/list', {
|
|
|
+ //查询工序需求的物料
|
|
|
+ operationIds: this.selectOperationIds,
|
|
|
+ } as RequestParamModel) as OperationMaterial[]
|
|
|
+ this.operationItems = []
|
|
|
+ if (this.operationMaterialArray) {
|
|
|
+ for (const element of this.operationMaterialArray) {
|
|
|
+ this.operationItems = this.operationItems.concat(element.itemList);
|
|
|
+ }
|
|
|
}
|
|
|
- console.log('hhtest', '---' + JSON.stringify(this.selectOperations))
|
|
|
})
|
|
|
Row().height(6)
|
|
|
}
|
|
@@ -292,7 +248,7 @@ export struct ProcessMaterialKitOneStep {
|
|
|
.width('100%')
|
|
|
}
|
|
|
.width('92.6%')
|
|
|
- .height(item.operationVO?.length! * 60)
|
|
|
+ .height(item.operationVO?.length! * this.fixed100px)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -305,7 +261,7 @@ export struct ProcessMaterialKitOneStep {
|
|
|
.borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.backgroundColor($r('app.color.10FFFFFF'))
|
|
|
-
|
|
|
+ // 工序所需物料
|
|
|
Column() {
|
|
|
Row() {
|
|
|
Text('需求物料')
|
|
@@ -318,30 +274,73 @@ export struct ProcessMaterialKitOneStep {
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
|
|
|
List() {
|
|
|
- ForEach(this.operationArray, (item: StationOperationInfo, index: number) => {
|
|
|
+ ForEach(this.operationMaterialArray, (item: OperationMaterial, index: number) => {
|
|
|
ListItem() {
|
|
|
- Row() {
|
|
|
- Row() {
|
|
|
- Text(item.stanTypeName ? item.stanTypeName : (item.stanType ? item.stanType : ''))
|
|
|
+ Column() {
|
|
|
+ Row({space: 5}) {
|
|
|
+ Circle()
|
|
|
+ .width($r('app.float.virtualSize_2')) // 设置圆点直径
|
|
|
+ .height($r('app.float.virtualSize_2'))
|
|
|
+ .fill($r('app.color.FFFFFF'))
|
|
|
+ Text(item.operationName ? item.operationName : '')
|
|
|
.fontSize($r('app.float.fontSize_9_6'))
|
|
|
.fontWeight(FontWeight.Medium)
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.maxLines(1)
|
|
|
}
|
|
|
- .height('100%')
|
|
|
- .width('91%')
|
|
|
- .alignItems(VerticalAlign.Bottom)
|
|
|
+ .height(this.fixed52px)
|
|
|
+ .width('100%')
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ ForEach(item.itemList, (material: OperationItem)=>{
|
|
|
+ Column({space: 5}) {
|
|
|
+ Row() {
|
|
|
+ Text(material.itemName! + '-' + material.itemCode!)
|
|
|
+ .fontSize($r('app.float.fontSize_6_4'))
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
|
|
|
+ Text((material.kitNum? material.kitNum : 0) + '/' + (material.storageNum? material.storageNum : 0))
|
|
|
+ .fontSize($r('app.float.fontSize_6_4'))
|
|
|
+ .fontWeight(FontWeight.Bold)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ Row() {
|
|
|
+ Text('型号:' + (material.itemModel ? material.itemModel : ''))
|
|
|
+ .fontSize($r('app.float.fontSize_4_8'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
+ Text('齐套/入库数量')
|
|
|
+ .fontSize($r('app.float.fontSize_4_8'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .fontColor($r('app.color.60FFFFFF'))
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+
|
|
|
+ Divider().vertical(false)
|
|
|
+ .color($r('app.color.10FFFFFF'))
|
|
|
+ .width('100%')
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height(this.fixed52px)
|
|
|
+ .justifyContent(FlexAlign.End)
|
|
|
+ })
|
|
|
+ Row().height(this.fixed38px)
|
|
|
}
|
|
|
- .height(item.operationVO?.length! * 14.5 + '%')
|
|
|
+ .height((item.itemList?.length! + 1) * this.fixed52px + this.fixed38px)
|
|
|
.width('92.6%')
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
- .backgroundColor(this.selectWorkOrder === index ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
.width('100%')
|
|
|
.height('90%')
|
|
|
+ .alignListItem(ListItemAlign.Center)
|
|
|
}
|
|
|
.height('100%')
|
|
|
.width('29.6%')
|