|
@@ -19,48 +19,51 @@ export struct OperationMaterialKitTwoStep {
|
|
@Link workOrder: WorkOrderInfo
|
|
@Link workOrder: WorkOrderInfo
|
|
@Link selectOperations: OperationInfo[]
|
|
@Link selectOperations: OperationInfo[]
|
|
@Link operationItems: OperationItem[]
|
|
@Link operationItems: OperationItem[]
|
|
|
|
+ @Link scanMaterialArray: MaterialInfo[]
|
|
|
|
+ // 选择已有料箱,出库料箱
|
|
|
|
+ @Consume('currentVehicleCode') currentVehicleCode: string
|
|
|
|
+
|
|
// 出库料箱中的库存物料信息
|
|
// 出库料箱中的库存物料信息
|
|
- @Link outMaterialBoxInfos: MaterialInfo[]
|
|
|
|
|
|
+ @State outMaterialBoxInfos: MaterialInfo[] = []
|
|
|
|
+ // 出库料箱中物料数量(出入口料口使用)
|
|
|
|
+ @State materialNum: number = 0
|
|
@State scanMaterialList: MaterialInfo[] = []
|
|
@State scanMaterialList: MaterialInfo[] = []
|
|
selectOperationIds: string[] = []
|
|
selectOperationIds: string[] = []
|
|
// 每个工序需要的物料编码分组
|
|
// 每个工序需要的物料编码分组
|
|
operationItemCodes: HashMap<string, string[]> = new HashMap<string, string[]>()
|
|
operationItemCodes: HashMap<string, string[]> = new HashMap<string, string[]>()
|
|
@State operationNames: string = ''
|
|
@State operationNames: string = ''
|
|
- // 选择已有料箱,出库料箱
|
|
|
|
- @State selectVehicleCode: string = ''
|
|
|
|
@State materialBoxInfos: MaterialBoxInfo[] = []
|
|
@State materialBoxInfos: MaterialBoxInfo[] = []
|
|
- @State materialNum: number = 0
|
|
|
|
// 空箱编码
|
|
// 空箱编码
|
|
@State vehicleCode: string = ''
|
|
@State vehicleCode: string = ''
|
|
- @State materialTotal: number = 0
|
|
|
|
// 扫描或手动输入的物料编码
|
|
// 扫描或手动输入的物料编码
|
|
@State scanCode: string = ''
|
|
@State scanCode: string = ''
|
|
// 物料全数组(本次扫描物料弹窗中展示)
|
|
// 物料全数组(本次扫描物料弹窗中展示)
|
|
@State materialArray: MaterialInfo[] = []
|
|
@State materialArray: MaterialInfo[] = []
|
|
// 数量合并的物料数组(在拣选工作台展示)
|
|
// 数量合并的物料数组(在拣选工作台展示)
|
|
@State materialMergeArray: MaterialInfo[] = []
|
|
@State materialMergeArray: MaterialInfo[] = []
|
|
- //齐套料箱扫码后如果物料存在则自动滚动所在列
|
|
|
|
|
|
+ //齐套料箱扫码后如果物料存在则自动滚动所在行
|
|
@State scanCodeIndex: number = -1
|
|
@State scanCodeIndex: number = -1
|
|
|
|
+ // 绑定物料数量
|
|
|
|
+ @State bindMaterialNum: number = 0
|
|
materialScrollerController: Scroller = new Scroller()
|
|
materialScrollerController: Scroller = new Scroller()
|
|
|
|
|
|
// 选择料箱弹窗控制器
|
|
// 选择料箱弹窗控制器
|
|
selectMaterialBoxDialogController: CustomDialogController = new CustomDialogController({
|
|
selectMaterialBoxDialogController: CustomDialogController = new CustomDialogController({
|
|
builder: SelectMaterialBoxDialog({
|
|
builder: SelectMaterialBoxDialog({
|
|
MaterialBoxInfos: this.materialBoxInfos,
|
|
MaterialBoxInfos: this.materialBoxInfos,
|
|
- selectVehicleCode: this.selectVehicleCode,
|
|
|
|
confirm: async () => {
|
|
confirm: async () => {
|
|
- if (!this.selectVehicleCode || !this.materialBoxInfos || this.materialBoxInfos.length <= 0) {
|
|
|
|
|
|
+ if (!this.currentVehicleCode || !this.materialBoxInfos || this.materialBoxInfos.length <= 0) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let houseNo = ''
|
|
let houseNo = ''
|
|
for (const element of this.materialBoxInfos) {
|
|
for (const element of this.materialBoxInfos) {
|
|
- if (this.selectVehicleCode === element.vehicleCode) {
|
|
|
|
|
|
+ if (this.currentVehicleCode === element.vehicleCode) {
|
|
houseNo = element.houseNo!
|
|
houseNo = element.houseNo!
|
|
}
|
|
}
|
|
}
|
|
}
|
|
let res: VehicleInfo = await WmsRequest.post('/api/v1/wmsOrder/outBox', {
|
|
let res: VehicleInfo = await WmsRequest.post('/api/v1/wmsOrder/outBox', {
|
|
houseNo: houseNo,
|
|
houseNo: houseNo,
|
|
- vehicleNo:this.selectVehicleCode,
|
|
|
|
|
|
+ vehicleNo:this.currentVehicleCode,
|
|
} as RequestParamModel)
|
|
} as RequestParamModel)
|
|
if (res && res.list) {
|
|
if (res && res.list) {
|
|
this.outMaterialBoxInfos = res.list
|
|
this.outMaterialBoxInfos = res.list
|
|
@@ -76,6 +79,8 @@ export struct OperationMaterialKitTwoStep {
|
|
builder: ThisScanDialog({
|
|
builder: ThisScanDialog({
|
|
materialMergeArray: this.materialMergeArray,
|
|
materialMergeArray: this.materialMergeArray,
|
|
materialArray: this.materialArray,
|
|
materialArray: this.materialArray,
|
|
|
|
+ outMaterialBoxInfos: this.outMaterialBoxInfos,
|
|
|
|
+ materialNum: this.materialNum,
|
|
confirm: async () => {}
|
|
confirm: async () => {}
|
|
}),
|
|
}),
|
|
autoCancel: true, // 点击遮罩关闭
|
|
autoCancel: true, // 点击遮罩关闭
|
|
@@ -122,9 +127,20 @@ export struct OperationMaterialKitTwoStep {
|
|
// 物料全数组默认都新增在数组头部
|
|
// 物料全数组默认都新增在数组头部
|
|
this.materialArray.unshift(res)
|
|
this.materialArray.unshift(res)
|
|
this.materialScrollerController.scrollToIndex(this.scanCodeIndex)
|
|
this.materialScrollerController.scrollToIndex(this.scanCodeIndex)
|
|
- for (const element of this.outMaterialBoxInfos) {
|
|
|
|
-
|
|
|
|
|
|
+ // 出库料箱中的库存物料 需要做出库操作
|
|
|
|
+ let toChangeArray: MaterialInfo[] = [...this.outMaterialBoxInfos]
|
|
|
|
+ for (let i = 0; i < toChangeArray.length; i++) {
|
|
|
|
+ let box = toChangeArray[i]
|
|
|
|
+ if (res.materialCode == box.materialCode) {
|
|
|
|
+ let value = box.num! - res.num!
|
|
|
|
+ box.num = value >= 0 ? value : 0
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ this.outMaterialBoxInfos = toChangeArray.filter((m) => {
|
|
|
|
+ return m.num! > 0
|
|
|
|
+ })
|
|
|
|
+ this.materialNum = this.outMaterialBoxInfos.length
|
|
}
|
|
}
|
|
|
|
|
|
// 齐套绑定
|
|
// 齐套绑定
|
|
@@ -166,6 +182,10 @@ export struct OperationMaterialKitTwoStep {
|
|
this.operationItems = this.operationItems.concat(element.itemList!);
|
|
this.operationItems = this.operationItems.concat(element.itemList!);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ this.bindMaterialNum += this.materialMergeArray.length
|
|
|
|
+ this.scanMaterialArray.concat(this.materialMergeArray)
|
|
|
|
+ this.materialArray = []
|
|
|
|
+ this.materialMergeArray = []
|
|
}
|
|
}
|
|
|
|
|
|
async aboutToAppear() {
|
|
async aboutToAppear() {
|
|
@@ -175,6 +195,7 @@ export struct OperationMaterialKitTwoStep {
|
|
if (b.operationSort === null) return -1;
|
|
if (b.operationSort === null) return -1;
|
|
return a.operationSort! - b.operationSort!;
|
|
return a.operationSort! - b.operationSort!;
|
|
})
|
|
})
|
|
|
|
+ // 拼接工序名称
|
|
for (let i = 0; i < this.selectOperations.length; i++) {
|
|
for (let i = 0; i < this.selectOperations.length; i++) {
|
|
this.operationNames += this.selectOperations[i].operationName
|
|
this.operationNames += this.selectOperations[i].operationName
|
|
if (i < this.selectOperations.length - 1) {
|
|
if (i < this.selectOperations.length - 1) {
|
|
@@ -332,7 +353,7 @@ export struct OperationMaterialKitTwoStep {
|
|
.objectFit(ImageFit.Fill)
|
|
.objectFit(ImageFit.Fill)
|
|
Column() {
|
|
Column() {
|
|
Row() {
|
|
Row() {
|
|
- Text('物料:' + this.materialTotal)
|
|
|
|
|
|
+ Text('物料:' + this.bindMaterialNum)
|
|
.fontSize($r('app.float.fontSize_24'))
|
|
.fontSize($r('app.float.fontSize_24'))
|
|
.fontColor($r('app.color.0A84FF'))
|
|
.fontColor($r('app.color.0A84FF'))
|
|
.fontWeight(FontWeight.Medium)
|
|
.fontWeight(FontWeight.Medium)
|
|
@@ -504,7 +525,7 @@ struct SelectMaterialBoxDialog {
|
|
vehicleTypeDictMap: HashMap<string, string> = new HashMap<string, string>()
|
|
vehicleTypeDictMap: HashMap<string, string> = new HashMap<string, string>()
|
|
MaterialBoxInfos: MaterialBoxInfo[] = []
|
|
MaterialBoxInfos: MaterialBoxInfo[] = []
|
|
scroller: Scroller = new Scroller()
|
|
scroller: Scroller = new Scroller()
|
|
- @Link selectVehicleCode: string
|
|
|
|
|
|
+ @Consume('currentVehicleCode') currentVehicleCode: string
|
|
|
|
|
|
async aboutToAppear() {
|
|
async aboutToAppear() {
|
|
if (!CommonConstants.DICT_DATA || CommonConstants.DICT_DATA.length <= 0) {
|
|
if (!CommonConstants.DICT_DATA || CommonConstants.DICT_DATA.length <= 0) {
|
|
@@ -591,12 +612,12 @@ struct SelectMaterialBoxDialog {
|
|
.width('32.8%')
|
|
.width('32.8%')
|
|
.height('25%')
|
|
.height('25%')
|
|
.borderRadius($r('app.float.virtualSize_16'))
|
|
.borderRadius($r('app.float.virtualSize_16'))
|
|
- .backgroundColor(this.selectVehicleCode === item.vehicleCode ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
|
|
|
|
|
|
+ .backgroundColor(this.currentVehicleCode === item.vehicleCode ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
|
|
.borderWidth(1)
|
|
.borderWidth(1)
|
|
- .borderColor(this.selectVehicleCode === item.vehicleCode ? $r('app.color.30D158') : $r('app.color.20FFFFFF'))
|
|
|
|
|
|
+ .borderColor(this.currentVehicleCode === item.vehicleCode ? $r('app.color.30D158') : $r('app.color.20FFFFFF'))
|
|
.margin({ top: index > 2 ? '1%' : '0%', left: (index % 3) === 0 ? '0%' : '0.8%' })
|
|
.margin({ top: index > 2 ? '1%' : '0%', left: (index % 3) === 0 ? '0%' : '0.8%' })
|
|
.onClick(()=>{
|
|
.onClick(()=>{
|
|
- this.selectVehicleCode = item.vehicleCode!
|
|
|
|
|
|
+ this.currentVehicleCode = item.vehicleCode!
|
|
})
|
|
})
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -655,7 +676,6 @@ struct SelectMaterialBoxDialog {
|
|
// 本次扫描物料弹窗
|
|
// 本次扫描物料弹窗
|
|
@CustomDialog
|
|
@CustomDialog
|
|
struct ThisScanDialog {
|
|
struct ThisScanDialog {
|
|
-
|
|
|
|
// 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
|
|
// 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
|
|
controller?: CustomDialogController
|
|
controller?: CustomDialogController
|
|
cancel?: () => void = () => {
|
|
cancel?: () => void = () => {
|
|
@@ -666,8 +686,12 @@ struct ThisScanDialog {
|
|
scroller: Scroller = new Scroller()
|
|
scroller: Scroller = new Scroller()
|
|
@Link materialArray: MaterialInfo[]
|
|
@Link materialArray: MaterialInfo[]
|
|
@Link materialMergeArray: MaterialInfo[]
|
|
@Link materialMergeArray: MaterialInfo[]
|
|
|
|
+ // 出库料箱的物料信息
|
|
|
|
+ @Link outMaterialBoxInfos: MaterialInfo[]
|
|
|
|
+ @Link materialNum: number
|
|
@State tempArray: MaterialInfo[] = []
|
|
@State tempArray: MaterialInfo[] = []
|
|
tempMergeArray: MaterialInfo[] = []
|
|
tempMergeArray: MaterialInfo[] = []
|
|
|
|
+ deleteArray: MaterialInfo[] = []
|
|
|
|
|
|
aboutToAppear(): void {
|
|
aboutToAppear(): void {
|
|
if (this.materialArray && this.materialArray.length > 0) {
|
|
if (this.materialArray && this.materialArray.length > 0) {
|
|
@@ -739,6 +763,7 @@ struct ThisScanDialog {
|
|
.width($r('app.float.virtualSize_48'))
|
|
.width($r('app.float.virtualSize_48'))
|
|
.fillColor($r('app.color.FF453A'))
|
|
.fillColor($r('app.color.FF453A'))
|
|
.onClick(()=>{
|
|
.onClick(()=>{
|
|
|
|
+ this.deleteArray.push(item)
|
|
for (let i = 0; i < this.tempMergeArray.length; i++) {
|
|
for (let i = 0; i < this.tempMergeArray.length; i++) {
|
|
if (this.tempMergeArray[i].materialCode! === this.tempArray[index].materialCode!) {
|
|
if (this.tempMergeArray[i].materialCode! === this.tempArray[index].materialCode!) {
|
|
if (this.tempMergeArray[i].num! === this.tempArray[index].num!) {
|
|
if (this.tempMergeArray[i].num! === this.tempArray[index].num!) {
|
|
@@ -803,6 +828,23 @@ struct ThisScanDialog {
|
|
this.materialMergeArray = []
|
|
this.materialMergeArray = []
|
|
this.materialArray = this.tempArray
|
|
this.materialArray = this.tempArray
|
|
this.materialMergeArray = this.tempMergeArray
|
|
this.materialMergeArray = this.tempMergeArray
|
|
|
|
+ let toChangeArray: MaterialInfo[] = [...this.outMaterialBoxInfos]
|
|
|
|
+ // 出库料箱把物料加回去
|
|
|
|
+ this.deleteArray.forEach((item) => {
|
|
|
|
+ // 中间列表遍历,将同一个数据的num进行运算
|
|
|
|
+ for (let i = 0; i < toChangeArray.length; i++) {
|
|
|
|
+ let box = toChangeArray[i]
|
|
|
|
+ if (item.materialCode == box.materialCode) {
|
|
|
|
+ let value = box.num! - item.num!
|
|
|
|
+ box.num = value >= 0 ? value : 0
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.outMaterialBoxInfos = toChangeArray.filter((m) => {
|
|
|
|
+ return m.num! > 0
|
|
|
|
+ })
|
|
|
|
+ this.materialNum = this.outMaterialBoxInfos.length
|
|
if (this.controller != undefined) {
|
|
if (this.controller != undefined) {
|
|
this.controller.close()
|
|
this.controller.close()
|
|
}
|
|
}
|