|
@@ -11,6 +11,7 @@ import VehicleInfo from '../../viewmodel/wms/VehicleInfo'
|
|
|
import { InBoundView } from '../../component/InBoundView'
|
|
|
import HouseStockMaterial from '../../viewmodel/wms/HouseStockMaterial'
|
|
|
import promptAction from '@ohos.promptAction'
|
|
|
+import OperationMaterial from '../../viewmodel/wms/OperationMaterial'
|
|
|
|
|
|
@Component
|
|
|
export struct OperationMaterialKitTwoStep {
|
|
@@ -18,7 +19,9 @@ export struct OperationMaterialKitTwoStep {
|
|
|
@Link workOrder: WorkOrderInfo
|
|
|
@Link selectOperations: OperationInfo[]
|
|
|
@Link operationItems: OperationItem[]
|
|
|
-
|
|
|
+ selectOperationIds: string[] = []
|
|
|
+ // 每个工序需要的物料编码分组
|
|
|
+ operationItemCodes: HashMap<string, string[]> = new HashMap<string, string[]>()
|
|
|
@State operationNames: string = ''
|
|
|
// 选择已有料箱,出库料箱
|
|
|
@State selectVehicleCode: string = ''
|
|
@@ -30,85 +33,9 @@ export struct OperationMaterialKitTwoStep {
|
|
|
// 扫描或手动输入的物料编码
|
|
|
@State scanCode: string = ''
|
|
|
// 物料全数组(本次扫描物料弹窗中展示)
|
|
|
- @State materialArray: HouseStockMaterial[] =[
|
|
|
- { materialName: "磷酸蚀刻液",
|
|
|
- materialCode: "WET-H3PO4",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "磷酸dsf",
|
|
|
- materialCode: "WET-H3PO5",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "ssdg",
|
|
|
- materialCode: "WET-H3PO6",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "磷酸蚀刻液",
|
|
|
- materialCode: "WET-H3PO4",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "fhgfh",
|
|
|
- materialCode: "WET-H3PO7",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "sdfdg",
|
|
|
- materialCode: "WET-H3PO8",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "磷酸蚀刻液",
|
|
|
- materialCode: "WET-H3PO4",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "磷酸蚀刻液we",
|
|
|
- materialCode: "WET-H3PO9",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "磷酸蚀刻液",
|
|
|
- materialCode: "WET-H3PO4",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- ]
|
|
|
-
|
|
|
+ @State materialArray: HouseStockMaterial[] = []
|
|
|
// 数量合并的物料数组(在拣选工作台展示)
|
|
|
- @State materialMergeArray: HouseStockMaterial[] = [ { materialName: "磷酸蚀刻液",
|
|
|
- materialCode: "WET-H3PO4",
|
|
|
- num: 40,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "磷酸dsf",
|
|
|
- materialCode: "WET-H3PO5",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "ssdg",
|
|
|
- materialCode: "WET-H3PO6",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "fhgfh",
|
|
|
- materialCode: "WET-H3PO7",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "sdfdg",
|
|
|
- materialCode: "WET-H3PO8",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"},
|
|
|
- { materialName: "磷酸蚀刻液we",
|
|
|
- materialCode: "WET-H3PO9",
|
|
|
- num: 10,
|
|
|
- spec: "-",
|
|
|
- unit: "克"}]
|
|
|
+ @State materialMergeArray: HouseStockMaterial[] = []
|
|
|
//齐套料箱扫码后如果物料存在则自动滚动所在列
|
|
|
@State scanCodeIndex: number = -1
|
|
|
materialScrollerController: Scroller = new Scroller()
|
|
@@ -153,6 +80,7 @@ export struct OperationMaterialKitTwoStep {
|
|
|
customStyle: true,
|
|
|
})
|
|
|
|
|
|
+ // 齐套操作-扫描物料
|
|
|
scanMaterialCode = async (itemCode: string) => {
|
|
|
this.scanCode = ""
|
|
|
let res: HouseStockMaterial = await WmsRequest.post("/api/v1/process/circulation/material", {
|
|
@@ -194,6 +122,47 @@ export struct OperationMaterialKitTwoStep {
|
|
|
this.materialScrollerController.scrollToIndex(this.scanCodeIndex)
|
|
|
}
|
|
|
|
|
|
+ // 齐套绑定
|
|
|
+ toCompleteKitting = async () => {
|
|
|
+ // 接口只支持根据工序去绑定,需要先遍历
|
|
|
+ let paramArray: RequestParamModel[] = []
|
|
|
+ this.operationItemCodes.forEach((value: string[], key: string) => {
|
|
|
+ let itemArray: HouseStockMaterial[] = []
|
|
|
+ for (const material of this.materialMergeArray) {
|
|
|
+ if (value.includes(material.materialCode)) {
|
|
|
+ itemArray.push(material)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 当前工序有齐套物料绑定
|
|
|
+ if (itemArray.length > 0) {
|
|
|
+ let param: RequestParamModel = {
|
|
|
+ operationId: key,
|
|
|
+ workOrderCode: this.workOrder.workOrderCode!,
|
|
|
+ vehicleCode: this.vehicleCode,
|
|
|
+ processVehicleMaterialList: itemArray
|
|
|
+ }
|
|
|
+ paramArray.push(param)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (paramArray.length <= 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for (const param of paramArray) {
|
|
|
+ await WmsRequest.post("api/v1/process/vehicleOperation/add", param)
|
|
|
+ }
|
|
|
+ // 重新刷新调取料箱下方物料已齐套数量
|
|
|
+ let result: OperationMaterial[] = await WmsRequest.post('/api/v1/wms/operationMaterial/list', {
|
|
|
+ //查询工序需求的物料
|
|
|
+ operationIds: this.selectOperationIds,
|
|
|
+ } as RequestParamModel) as OperationMaterial[]
|
|
|
+ this.operationItems = []
|
|
|
+ if (result && result.length > 0) {
|
|
|
+ for (const element of result) {
|
|
|
+ this.operationItems = this.operationItems.concat(element.itemList!);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async aboutToAppear() {
|
|
|
if (this.selectOperations) {
|
|
|
this.selectOperations.sort((a: OperationInfo, b: OperationInfo) => {
|
|
@@ -208,6 +177,20 @@ export struct OperationMaterialKitTwoStep {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ for (const operation of this.selectOperations) {
|
|
|
+ this.selectOperationIds.push(operation.id!)
|
|
|
+ for (const item of this.operationItems) {
|
|
|
+ if (operation.id != item.operationId) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ let itemCodes: string[] = []
|
|
|
+ if (this.operationItemCodes.hasKey(operation.id)) {
|
|
|
+ itemCodes = this.operationItemCodes.get(operation.id)
|
|
|
+ }
|
|
|
+ itemCodes.push(item.itemCode!)
|
|
|
+ this.operationItemCodes.set(operation.id, itemCodes)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
build() {
|
|
@@ -483,6 +466,9 @@ export struct OperationMaterialKitTwoStep {
|
|
|
.height('7.3%')
|
|
|
.borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
.backgroundColor($r('app.color.20FFFFFF'))
|
|
|
+ .onClick(async ()=>{
|
|
|
+ this.toCompleteKitting()
|
|
|
+ })
|
|
|
}
|
|
|
.height('100%')
|
|
|
.width('29.6%')
|