import ProcessData from '../../model/ProcessData'; import StorageRequest from '../util/request/StorageRequest'; import {SelectMaterialslist} from '../util/request/StorageRequestInstance' import detailsList from '../../model/DetailsList'; /////物料位置 ////出库取料箱出库 export interface Tasklist { //批次号 batchCode?: string; ///完成数量 completedNum?:number //已经占用箱数 useNum?:number //空箱数 emptyBoxNum?:string //可用箱数 canUsedNum?:string //总容量箱数 allNum?:number //仓储类型 type?:string //批次号 coordinate?: string //创建时间 created?: string // creator?: string //仓库编码 houseNo?:string deptId?: string houseType?:string //主键 id?:string locationNo?: string // 物料名称 materialName?:string //物料编码 materialNo?: string //出入库数量 num?: number orgId?: string relPlanNo?:string relOrderNo?:string relOutOrderNo?:string progress?:string planNo?: string position?: string // 序列号 seqNo?: string // 状态;1-待处理;2-处理中;3-处理异常;4-已完成 state?:number // 库存数量 stockNum?:string //出入库任务单号 taskNo?: string unit?:string updated?: string //任务名称 taskName?:string updator?: string vehicleNo?: string } export interface Materialpositionclass { //产品规格 spec?:string //批次号 batchCode?: string; ///完成数量 completedNum?:number //已经占用箱数 useNum?:number //空箱数 emptyBoxNum?:string //可用箱数 canUsedNum?:string //总容量箱数 allNum?:number //仓储类型 type?:string //批次号 coordinate?: string //创建时间 created?: string // creator?: string //仓库编码 houseNo?:string deptId?: string houseType?:string //主键 id?:string locationNo?: string // 物料名称 materialName?:string //物料编码 materialNo?: string //出入库数量 num?: number orgId?: string planNo?: string position?: string // 序列号 seqNo?: string // 状态;1-待处理;2-处理中;3-处理异常;4-已完成 state?:number // 库存数量 stockNum?:string //出入库任务单号 taskNo?: string unit?:string updated?: string //任务名称 taskName?:string updator?: string vehicleNo?: string pageNo?:number pageSize?:number } export interface outboundDataclass { detailsList?:detailsList[] taskId?:number index?:number //产品规格 spec?:string // 物料名称 materialName?:string //物料编码 materialNo?: string // 序列号 seqNo?: string //储位坐标 coordinate?:string //仓库编号 houseNo?:string //储位编号 locationNo?:string //单位 unit?:string //数量 num?:number //批次号 batchCode?:string } export interface outboundRequestData { index?:number //产品规格 spec?:string // 物料名称 materialName?:string //物料编码 materialNo?: string // 序列号 seqNo?: string //储位坐标 coordinate?:string //仓库编号 houseNo?:string //储位编号 locationNo?:string //单位 unit?:string //数量 num?:number //批次号 batchCode?:string //载具编号 vehicleCode?:string position?:string housetype?:string } @CustomDialog struct positionok { // outboundData = async() : Promise => { // let obj:outboundDataclass[] = [] // let res = await StorageRequest.post("/api/v3/wmsOrder/outBox", { // detailsList:this.outboundRequest, // taskId:'1' // }) // console.log('testTag', '********' + JSON.stringify(res)) // obj = JSON.parse(JSON.stringify(res)) // return obj // } //传进来 // aboutToAppear(){ // for (let index = 0; index < this.Mposition.length; index++) { // let details: outboundRequestData = {} // details.materialName = this.Mposition[index].materialName // details.num=this.Mposition[index].num // details.materialNo=this.Mposition[index].materialNo // details.spec=this.Mposition[index].spec // details.batchCode=this.Mposition[index].batchCode // details.housetype='1' // details.locationNo='1-3-2' // details.houseNo='1' // details.coordinate= '3-2' // details.unit='个' // details.vehicleCode='XL'+new Date().getTime() // details.position='1' // this.Mposition.push(details) // } // } @State private outboundRequest:Array=[] @Link private Mposition:Array< Materialpositionclass> @Link code:string @Link textValue: string @Link inputValue: string controller: CustomDialogController // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后 cancel: () => void confirm: () => void build(){ Column(){ Column({space:10}){ Text('取出确认') .width('100%') .fontSize('51px') .textAlign(TextAlign.Center) Row(){ Text('是否取出'+this.code+'?') .width('100%') .fontSize('32px') }.width('80%') .height('60%') Row({space:5}){ Text('取消') .fontWeight(FontWeight.Medium) .fontSize('32px') .width('48%') .textAlign(TextAlign.Center) .height('100%') .fontColor('#0A59F7') .backgroundColor('#F1F3F5') .borderRadius(21) .onClick(()=>{ this.controller.close() }) Text('确认') .fontWeight(FontWeight.Medium) .fontSize('32px') .borderRadius(21) .textAlign(TextAlign.Center) .height('100%') .width('48%') .fontColor('#0A59F7') .backgroundColor('#F1F3F5') .onClick(()=>{ // this. outboundData ().then((res : outboundRequestData[]) => { // console.log('testTag', '入库数据成功'+JSON.stringify(res)) // if (res && res.length > 0) { // // // for (let index = 0; index < res.length; index++) { // console.log('testTag', '-----------index' + index +'-----vehicleNo'+JSON.stringify(res)) // console.log('testTag', '-----------index' + index +'-----list'+JSON.stringify(res)) // } // this. outboundRequest = res // } // }) // console.log("4632957"+JSON.stringify(this.outboundRequest)) // this.controller.close() }) } .justifyContent(FlexAlign.Center) .borderRadius(15) .width('80%') .height('20%') }.width('100%') .padding(10) .height('100%') .borderRadius(15) .backgroundColor('#FFFF') }.width("50%") .height("40%") .backgroundColor('#4d000000') } } @CustomDialog struct ChuKUA { @State private Mposition:Array=[] @State private SelectMaterial:Array=[] @State material:string='' @State taskNo:string='' ////确认弹窗 @State code:string='' dialogController: CustomDialogController = new CustomDialogController({ builder: positionok({ Mposition:this.Mposition, code:this.code, textValue: $textValue, inputValue: $inputValue }), autoCancel: true, alignment: DialogAlignment.Center, customStyle: true }) Tasklistoutbound = async() : Promise => { let obj: Tasklist[] = [] let res = await StorageRequest.post("/api/v3/task/list", { type: 2 }) console.log('testTag', 'Tasklist成功' + JSON.stringify(res)) obj = JSON.parse(JSON.stringify(res)) console.log('testTag', 'aaaaaaaa' +JSON.stringify(obj)); return obj } SelectMaterials = async() : Promise => { let res = await StorageRequest.post("/api/v3/task/page", { pageNo: 1, taskNo:this.taskNo }) console.log('testTag', '********' + JSON.stringify(res)) let obj = JSON.parse(JSON.stringify(res)) console.log('testTag', 'aaaaaaaa' +JSON.stringify(obj.records)); this.SelectMaterial=obj return obj.records } ///位置请求 Materialposition = async() : Promise< Materialpositionclass[]> => { let obj: Materialpositionclass[] = [] let res = await StorageRequest.post("/api/v3/stock/list", { "materialName":this.material // "materialName":"物料名称001" }) console.log('testTag', '111111成功' + JSON.stringify(res)) obj = JSON.parse(JSON.stringify(res)) console.log('testTag', 'aaaaaaaa' +JSON.stringify(obj)); this.Mposition=obj return obj } aboutToAppear(){ this.Tasklistoutbound().then((res : Tasklist[]) => { console.log('testTag', 'result cccccc'+JSON.stringify(res)) if (res && res.length > 0) { this.TasklistoutboundData = res this.taskNo=this.TasklistoutboundData[0].taskNo this.SelectMaterials().then((res : SelectMaterialslist[]) => { console.log('testTag', 'result cccccc'+JSON.stringify(res)) if (res && res.length > 0) { this.SelectMaterial = res this.material= this.SelectMaterial[0].materialName this.Materialposition().then((res :Materialpositionclass[]) => { console.log('testTag', 'result cccccc'+JSON.stringify(res)) if (res && res.length > 0) { this.Mposition = res } }) } }) } }) } @State private TasklistoutboundData:Array=[] @Link CunQuHuo:number scroller: Scroller = new Scroller() @State SelectableMarker:number=0 @State SelectableMarkerOne:number=0 @State SelectableMarkertwo:number=0 @Link textValue: string @Link inputValue: string controller: CustomDialogController // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后 cancel: () => void confirm: () => void build() { Column() { Column(){ Text('取物料') .fontWeight(FontWeight.Medium) .textAlign(TextAlign.Center) .fontColor('#ffff') .fontSize('51px') }.width('100%') .justifyContent(FlexAlign.Center) .height('10%') .padding(10) Row(){ Text('出库') .fontSize('40px') .width('30%') .padding(10) .fontColor('#ffff') Text('选择物料') .fontSize('40px') .width('30%') .padding(10) .fontColor('#ffff') Text('取出位置') .fontSize('40px') .width('30%') .padding(10) .fontColor('#ffff') }.width('100%') .height('5%') .padding({left:10}) Row({space:20}){ Column(){ Grid(this.scroller) { ForEach(this.TasklistoutboundData, (item:Tasklist ,index:number) => { // ForEach(this.Number, (day: string) => { GridItem() { Row(){ Column(){ Text(item.taskName) .fontSize('32px') .width('100%') .height('20%') Row(){ Column({space:10}){ Text('产品型号:'+item.taskNo) .fontSize($r('app.float.robot_state_font_size')) .textAlign(TextAlign.Start) .fontColor('#99000000') .width('100%') Text('计划编号:'+item.relPlanNo) .fontSize($r('app.float.robot_state_font_size')) .textAlign(TextAlign.Start) .fontColor('#99000000') .width('100%') Text('订单编号:'+item.relOrderNo) .fontSize($r('app.float.robot_state_font_size')) .textAlign(TextAlign.Start) .fontColor('#99000000') .width('100%') Text('出库单号:'+item.relOutOrderNo) .fontSize($r('app.float.robot_state_font_size')) .textAlign(TextAlign.Start) .fontColor('#99000000') .width('100%') Text('取料进度:'+item.progress) .fontSize($r('app.float.robot_state_font_size')) .textAlign(TextAlign.Start) .fontColor('#99000000') .width('100%') } .justifyContent(FlexAlign.Center) .width('100%') .height('100%') } .width('100%') .height('80%') }.width('100%') .padding({left:20,right:20}) .borderRadius(10) .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') .onClick(()=>{ this.taskNo=item.taskNo }) } .padding(10) .borderRadius(10) .height('30%') .backgroundColor(this.SelectableMarker===index? $r('app.color.robot_set_card_blue'):$r('app.color.robot_set_card_white')) } .onClick(()=>{ this.SelectableMarker=index }) }) } .onClick(()=>{ this.CunQuHuo=1 }) .padding(10) .columnsTemplate('1fr') .columnsGap(10) .rowsGap(10) .onScrollIndex((first: number) => { console.info(first.toString()) }) .width('100%') .height('100%') }.width('25%') .height('100%') Divider().vertical(true) .color('#ffff') .width('1%') .height('100%') ////选择物料 Column(){ Grid(this.scroller) { ForEach(this.SelectMaterial, (item:SelectMaterialslist,index:number) => { // ForEach(this.Number, (day: string) => { GridItem() { Row(){ Column(){ Blank() Text(item.materialName) .fontSize('32px') .fontWeight(FontWeight.Medium) Text(item.materialNo) .fontSize('27px') Blank() Text(item.completedNum.toString()+'/'+item.num.toString()) .fontWeight(FontWeight.Bold) . fontSize('32px') .fontColor('#e6000000') Text(item.state===0||1?"待处理":item.state===2?"处理中":item.state===3?"处理异常":"已完成") .fontSize('32px') Blank() }.width('100%') .padding(10) .borderRadius(10) .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') } .padding(10) .borderRadius(10) .height('30%') .backgroundColor(this.SelectableMarkerOne===index? $r('app.color.robot_set_card_blue'):$r('app.color.robot_set_card_white')) } .onClick(()=>{ this.material= item.materialName console.log('好了111111'+item.materialName) // this.Materialposition() this.SelectableMarkerOne=index }) }) } .onClick(()=>{ this.CunQuHuo=1 }) .padding(10) .columnsTemplate('1fr') .columnsGap(10) .rowsGap(10) .onScrollIndex((first: number) => { console.info(first.toString()) }) .width('100%') .height('100%') }.width('25%') .height('100%') Divider().vertical(true) .color('#ffff') .width('1%') .height('100%') //物料位置 Column(){ Grid(this.scroller) { ForEach(this.Mposition, (item:Materialpositionclass,index:number) => { GridItem() { Row(){ Column(){ Text(item.locationNo) .fontSize('32px') .fontWeight(FontWeight.Medium) Text(item.batchCode) .fontSize('32px') .fontWeight(FontWeight.Medium) Blank() Row(){ Text(item.num.toString()) .fontSize('51px') .fontWeight(FontWeight.Bold) Text('个') .fontSize('32px') .fontWeight(FontWeight.Medium) } }.width('100%') .padding(10) .borderRadius(10) .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') } .padding(10) .borderRadius(10) .height('30%') .backgroundColor(this.SelectableMarkertwo===index? $r('app.color.robot_set_card_blue'):$r('app.color.robot_set_card_white')) .onClick(()=>{ this.dialogController.open() this.SelectableMarkertwo=index this.code= item.batchCode }) } .padding({left:20}) }) } .onClick(()=>{ this.CunQuHuo=1 }) .padding(10) .columnsTemplate('1fr 1fr') .columnsGap(10) .rowsGap(10) .onScrollIndex((first: number) => { console.info(first.toString()) }) .width('100%') .height('100%') }.width('37%') .height('100%') }.width('100%') .height('75%') .padding(10) Row(){ Image($r('app.media.close')) .width('115px') .height('115px') .onClick(()=>{ this.controller.close() }) }.width('100%') .justifyContent(FlexAlign.Center) .height('10%') }.width('100%') .backgroundColor('#99000000') .height('100%') // dialog默认的borderRadius为24vp,如果需要使用border属性,请和borderRadius属性一起使用。 } } @CustomDialog @Entry @Component export struct Workbin{ @State textValue: string = '' @State inputValue: string = '' scroller: Scroller = new Scroller() onCancel() { console.info('onCancel') } onAccept() { console.info(' onAccept') } existApp() { console.info(' existApp') } @State ZhuangTai:number=0 @State CunQuHuo:number=0 MaterialRetrievalController: CustomDialogController = new CustomDialogController({ builder: ChuKUA({ CunQuHuo:this.CunQuHuo, cancel: this.onCancel, confirm: this.onAccept, textValue: $textValue, inputValue: $inputValue, }), // gridCount: 3, cancel: this.existApp, //autoCancel: true, alignment: DialogAlignment.Bottom, //offset: { dx: 0, dy: -20 }, gridCount: 4, customStyle: true, }) build(){ Row({space:15}){ Row(){ Column(){ Text('取物料') .fontSize('32px') .fontWeight(FontWeight.Medium) Text('查找物料') .fontSize('27px') }.width('90%') .borderRadius(15) .backgroundColor('#ffff') .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') .onClick(()=>{ this. MaterialRetrievalController.open() }) Column(){ Image($r('app.media.jiaobiao')) .width('27px') .height('27px') }.width('10%') .justifyContent(FlexAlign.End) .height('100%') .backgroundColor('#ffff') } .backgroundColor('#ffff') .padding(10) .width('45%') .borderRadius(15) .height('100%') Row(){ Column(){ Text('返回料箱') .fontSize('32px') .fontWeight(FontWeight.Medium) Text('LX1524742389') .fontSize('27px') }.width('90%') .borderRadius(15) .backgroundColor('#ffff') .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') Column(){ Image($r('app.media.jiaobiao')) .width('27px') .height('27px') }.width('10%') .justifyContent(FlexAlign.End) .height('100%') } .padding(10) // .onClick(()=>{ // this.bufferhopperController.open() // }) .backgroundColor('#ffff') .width('45%') .borderRadius(15) .height('100%') }.width('100%') .padding({left:10}) .height('100%') } }