|
@@ -25,12 +25,13 @@ import { ConfirmDialogParams, RgvInfo } from '../params/RobotsParam';
|
|
|
import promptAction from '@ohos.promptAction';
|
|
|
import VehicleInfo from '../viewmodel/wms/VehicleInfo';
|
|
|
import MaterialInfo from '../viewmodel/wms/MaterialInfo';
|
|
|
+import { InfoRow } from '../component/RgvControlView';
|
|
|
|
|
|
@Entry
|
|
|
@Component
|
|
|
struct LittleMaterialsOutBound {
|
|
|
- // 输入的物料编码
|
|
|
- @State inputCode: string = ''
|
|
|
+ // 输入的物料名称
|
|
|
+ @State inputValue: string = ''
|
|
|
// 查询到的物料库存列表
|
|
|
@State materialArray: MaterialBoxInfo[] = []
|
|
|
// 选中的库存的物料编码
|
|
@@ -51,31 +52,73 @@ struct LittleMaterialsOutBound {
|
|
|
outMaterialBoxInfos: MaterialInfo[] = []
|
|
|
// 扫码待出库的物料
|
|
|
@State scanMaterialList: MaterialInfo[] = []
|
|
|
+ //扫码后自动滚动第一行
|
|
|
+ @State scanCodeIndex: number = -1
|
|
|
+ materialScrollerController: Scroller = new Scroller()
|
|
|
|
|
|
@State currentStep: number = 1;
|
|
|
@State nextStepButtonClick: number = 1
|
|
|
@State preStepButtonClick: number = 1
|
|
|
@State outBoundButtonClick :number = 1
|
|
|
+ @State confirmOutboundButtonClick :number = 1
|
|
|
|
|
|
// 根据物料编码【模糊】查询库存
|
|
|
- getStoreList = async () => {
|
|
|
- let res: MaterialBoxInfo[] = await WmsRequest.post('/api/v1/stock/mergeList', {
|
|
|
+ getStoreListFunc = async () => {
|
|
|
+ let res: MaterialBoxInfo[] = await WmsRequest.post('/api/v1/stock/list', {
|
|
|
houseType: '1',
|
|
|
- materialNo: this.inputCode
|
|
|
+ materialNo: this.inputValue
|
|
|
} as RequestParamModel)
|
|
|
- this.inputCode = ''
|
|
|
+ this.inputValue = ''
|
|
|
if (res && res.length > 0) {
|
|
|
this.materialArray = res
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//请求物料位置
|
|
|
- queryMaterialPosition = async () => {
|
|
|
+ queryMaterialPositionFunc = async () => {
|
|
|
this.materialBoxInfos = await WmsRequest.post('/api/v1/stock/groupList', {
|
|
|
materialNo: this.selectMaterialCode
|
|
|
} as RequestParamModel)
|
|
|
}
|
|
|
+ // 扫码物料编码方法
|
|
|
+ scanMaterialCodeFunc = async (itemCode: string) => {
|
|
|
+ this.scanCode = ''
|
|
|
+ let res: MaterialInfo = await WmsRequest.post('/api/v1/process/circulation/material', {
|
|
|
+ label: itemCode //'#gys022#sc022#100#20220929#31'
|
|
|
+ } as RequestParamModel)
|
|
|
|
|
|
+ // 物料默认都新增在数组头部
|
|
|
+ this.scanMaterialList.unshift(res)
|
|
|
+ this.scanCodeIndex = 0
|
|
|
+ this.materialScrollerController.scrollToIndex(this.scanCodeIndex)
|
|
|
+ // 出库料箱中的库存物料 需要做出库操作
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ // for (let i = this.outMaterialBoxInfos.length - 1; i >= 0; i--) {
|
|
|
+ // if (this.outMaterialBoxInfos[i].materialCode! === res.materialCode!) {
|
|
|
+ // if (this.outMaterialBoxInfos[i].num! > res.num!) {
|
|
|
+ // this.outMaterialBoxInfos[i].num = this.outMaterialBoxInfos[i].num! - res.num!
|
|
|
+ // break
|
|
|
+ // } else if (this.outMaterialBoxInfos[i].num! === res.num!) {
|
|
|
+ // this.outMaterialBoxInfos.splice(i, 1)
|
|
|
+ // break
|
|
|
+ // } else {
|
|
|
+ // res.num = res.num! - this.outMaterialBoxInfos[i].num!
|
|
|
+ // this.outMaterialBoxInfos.splice(i, 1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ this.materialNum = this.outMaterialBoxInfos.length
|
|
|
+ }
|
|
|
// 抽屉称重(根据重量判断抽屉是否有料箱)
|
|
|
@StorageLink('materialBoxWeight') materialBoxWeight: number = 0
|
|
|
// 抽屉状态
|
|
@@ -106,7 +149,7 @@ struct LittleMaterialsOutBound {
|
|
|
}),
|
|
|
cancel: () => console.log('用户取消操作'),
|
|
|
customStyle: true,
|
|
|
- autoCancel:false,
|
|
|
+ autoCancel: false,
|
|
|
maskColor: 'rgba(0,0,0,0.6)'
|
|
|
});
|
|
|
this.commonDialogController.open();
|
|
@@ -125,9 +168,9 @@ struct LittleMaterialsOutBound {
|
|
|
}
|
|
|
|
|
|
// 料箱出库的方法
|
|
|
- callBoxOutboundFun = async () => {
|
|
|
+ callBoxOutboundFunc = async () => {
|
|
|
if (this.selectVehicleIndex < 0) {
|
|
|
- this.reminds = "请选择料箱"
|
|
|
+ this.reminds = "请先选择料箱"
|
|
|
this.remindController.open()
|
|
|
setTimeout(() => {
|
|
|
this.remindController.close()
|
|
@@ -272,10 +315,10 @@ struct LittleMaterialsOutBound {
|
|
|
.width('100%')
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.onClick(()=>{
|
|
|
- this.getStoreList()
|
|
|
+ this.getStoreListFunc()
|
|
|
})
|
|
|
Row() {
|
|
|
- TextInput({ text: this.inputCode, placeholder: '录入物料名称' })
|
|
|
+ TextInput({ text: this.inputValue, placeholder: '录入物料名称' })
|
|
|
.type(InputType.Normal)
|
|
|
.width('84%')
|
|
|
.placeholderFont({ size: $r('app.float.fontSize_16') })
|
|
@@ -283,10 +326,10 @@ struct LittleMaterialsOutBound {
|
|
|
.fontSize($r('app.float.fontSize_24'))
|
|
|
.fontColor($r('app.color.FFFFFF'))
|
|
|
.onSubmit(() => {
|
|
|
- this.getStoreList()
|
|
|
+ this.getStoreListFunc()
|
|
|
})
|
|
|
.onChange((value: string) => {
|
|
|
- this.inputCode = value
|
|
|
+ this.inputValue = value
|
|
|
})
|
|
|
Row() {
|
|
|
Image($r('app.media.wms_search'))
|
|
@@ -347,7 +390,7 @@ struct LittleMaterialsOutBound {
|
|
|
.onClick(()=>{
|
|
|
this.selectMaterialCode = item.materialNo!
|
|
|
if (this.selectMaterialCode && this.selectMaterialCode.length > 0) {
|
|
|
- this.queryMaterialPosition()
|
|
|
+ this.queryMaterialPositionFunc()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -504,7 +547,7 @@ struct LittleMaterialsOutBound {
|
|
|
this.scanCode = value
|
|
|
})
|
|
|
.onSubmit(async () => {
|
|
|
-
|
|
|
+ this.scanMaterialCodeFunc(this.scanCode)
|
|
|
})
|
|
|
}
|
|
|
.height('48.7%')
|
|
@@ -521,6 +564,121 @@ struct LittleMaterialsOutBound {
|
|
|
.width('100%')
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.alignItems(VerticalAlign.Top)
|
|
|
+ // 扫码物料列表
|
|
|
+ List({ scroller: this.materialScrollerController }) {
|
|
|
+ ForEach(this.scanMaterialList, (item: MaterialInfo, index: number) => {
|
|
|
+ ListItem() {
|
|
|
+ Row() {
|
|
|
+ Column({space: 1}) {
|
|
|
+ Text(item.materialName! + '-' + item.materialCode!)
|
|
|
+ .fontSize($r('app.float.fontSize_24'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
+ Column() {
|
|
|
+ Text('型号:' + item.spec!)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
+ Text('序列号:' + item.batchCode!)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
+ Text('所属订单:-')
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
+ Text('数量:' + item.num!)
|
|
|
+ .fontSize($r('app.float.fontSize_16'))
|
|
|
+ .fontWeight(FontWeight.Lighter)
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .maxLines(1)
|
|
|
+ }
|
|
|
+ .height('52.8%')
|
|
|
+ .width('100%')
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
+ }
|
|
|
+ .height('100%')
|
|
|
+ .width('48%')
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+
|
|
|
+ Row() {
|
|
|
+ Image($r('app.media.material_delete'))
|
|
|
+ .height($r('app.float.virtualSize_48'))
|
|
|
+ .width($r('app.float.virtualSize_48'))
|
|
|
+ .fillColor($r('app.color.FF453A'))
|
|
|
+ .onClick(()=>{
|
|
|
+ // 出库料箱中的物料需要加回去
|
|
|
+ let toChangeArray: MaterialInfo[] = [...this.outMaterialBoxInfos]
|
|
|
+ let hasFlag: boolean = false
|
|
|
+ // 出库料箱中还有,则把数量加回去
|
|
|
+ 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
|
|
|
+ hasFlag = true
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 出库料箱中没有,则把这一项加进去
|
|
|
+ if (!hasFlag) {
|
|
|
+ this.outMaterialBoxInfos.push(item)
|
|
|
+ }
|
|
|
+ // 扫码待出库的物料删除这一项
|
|
|
+ this.scanMaterialList.splice(index, 1)
|
|
|
+ })
|
|
|
+ Row().width('2%')
|
|
|
+ }
|
|
|
+ .height('100%')
|
|
|
+ .width('50%')
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ .justifyContent(FlexAlign.End)
|
|
|
+ }
|
|
|
+ .height('26%')
|
|
|
+ .width('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .borderRadius($r('app.float.virtualSize_16'))
|
|
|
+ .backgroundColor($r('app.color.10FFFFFF'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('96.6%')
|
|
|
+ .height('72.5%')
|
|
|
+ .alignListItem(ListItemAlign.Center)
|
|
|
+ // 确认出库按钮
|
|
|
+ Row() {
|
|
|
+ Button('确认出库')
|
|
|
+ .fontSize($r('app.float.fontSize_24'))
|
|
|
+ .fontColor($r('app.color.0A84FF'))
|
|
|
+ .width('42.4%')
|
|
|
+ .height('56.3%')
|
|
|
+ .backgroundColor($r('app.color.20FFFFFF'))
|
|
|
+ .opacity(this.scanMaterialList.length > 0 ? 1 : 0.3)
|
|
|
+ .scale({ x: this.confirmOutboundButtonClick, y: this.confirmOutboundButtonClick })
|
|
|
+ .animation({
|
|
|
+ duration: 200,
|
|
|
+ curve: Curve.Linear // 弹性曲线更生动
|
|
|
+ })
|
|
|
+ .onClick(() => {
|
|
|
+ if (this.scanMaterialList.length <= 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.confirmOutboundButtonClick = 0.9; // 点击时缩小
|
|
|
+ setTimeout(() => {
|
|
|
+ this.confirmOutboundButtonClick = 1; // 0.2秒后恢复
|
|
|
+ }, 200);
|
|
|
+ this.scanMaterialList = []
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('12.5%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
}
|
|
|
.height('100%')
|
|
|
.width('64.8%')
|
|
@@ -602,7 +760,7 @@ struct LittleMaterialsOutBound {
|
|
|
setTimeout(() => {
|
|
|
this.outBoundButtonClick = 1; // 0.2秒后恢复
|
|
|
}, 200);
|
|
|
- this.callBoxOutboundFun()
|
|
|
+ this.callBoxOutboundFunc()
|
|
|
})
|
|
|
|
|
|
Row().width('1.2%')
|