Browse Source

出库根据物料编码扫码出库

yixiaojun 1 year ago
parent
commit
c7cfd032d2

+ 2 - 2
entry/src/main/ets/common/util/request/StorageRequest.ets

@@ -2,7 +2,7 @@ import axios, { AxiosError, AxiosResponse, AxiosRequestHeaders,AxiosRequestConfi
 import CommonConstants from '../../constants/CommonConstants';
 import { printError, printRequest, printResponse, handleRes } from './Helps';
 
-const baseUrl = "http://192.168.101.4:8088/"
+const baseUrl = "http://192.168.101.4:8079/"
 const DEBUG = true //
 
 // 创建实例
@@ -20,7 +20,7 @@ const StorageRequest = axios.create(
 StorageRequest.interceptors.request.use((config: InternalAxiosRequestConfig) => {
 
   // 以后登录之后可以在这里传
-  config.headers.Authorization = CommonConstants.AUTH_TOKEN
+  config.headers.Authorization = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOnsiaWQiOjEsInVzZXJOYW1lIjoiYWRtaW4iLCJkZXB0SWQiOjAsInN0YXRpb25JZCI6IjEiLCJsb2dpblR5cGUiOjEsIm9yZ0lkIjowfSwiZGV2aWNlIjoiZGVmYXVsdC1kZXZpY2UiLCJlZmYiOjE3MTI5MDYxMjEzMjAsInJuU3RyIjoiMmhRUmM0RDJuUGtEa2J6SHBzelJ3VGpUVWZ2Nkg0WlkifQ.3ptwM0nhmQ_QYaHSzc_iXMhLZ5Gg8t9cnk35PStQ3YA'
 
   printRequest(config)
 

+ 3 - 11
entry/src/main/ets/view/IntelligentWarehousingOutbound.ets

@@ -494,7 +494,6 @@ struct Outbound {
   @Link CunQuHuo:number
   scroller: Scroller = new Scroller()
   controller: CustomDialogController
-
   build() {
       Column(){
         Text('选择工位')
@@ -545,8 +544,6 @@ struct Outbound {
       .height('70%')
       .backgroundColor('#ffff')
       .borderRadius(20)
-
-
     // dialog默认的borderRadius为24vp,如果需要使用border属性,请和borderRadius属性一起使用。
   }
 }
@@ -608,7 +605,6 @@ struct materialLocation {
                         .fontSize('32px')
                         .fontWeight(FontWeight.Medium)
                     }
-
                   }.width('100%')
                   .padding(10)
                   .borderRadius(10)
@@ -823,6 +819,7 @@ struct bufferf {
 @Entry
 @Component
 export struct IntelligentWarehousingOutbound{
+  @State materialNo:string=''
   @State private Mposition:Array<Materialpositionclass>=[]
   @State material:string=''
   @State SelectableMarkerOne:number=0
@@ -1082,7 +1079,6 @@ build(){
                       Text(item.materialNo)
                         .fontSize('27px')
                       Blank()
-
                       Text(item.completedNum.toString()+'/'+item.num.toString())
                         .fontWeight(FontWeight.Bold)
                         . fontSize('32px')
@@ -1090,7 +1086,6 @@ build(){
                       Text(item.state===0||1?"待处理":item.state===2?"处理中":item.state===3?"处理异常":"已完成")
                         .fontSize('32px')
                       Blank()
-
                     }.width(item.completedNum===0?'80%':'100%')
                     .padding(10)
                     .borderRadius(10)
@@ -1102,7 +1097,6 @@ build(){
                         .height('100%')
                         .width('20%')
                     }else {
-
                     }
 
                   }
@@ -1113,6 +1107,7 @@ build(){
                   $r('app.color.robot_set_card_blue'):$r('app.color.robot_set_card_white'))
                 }
                 .onClick(()=>{
+                  this.materialNo=item.materialNo
                   this.material= item.materialName
                   console.log('好了111111'+item.materialName)
                   this.materialLocationController.open()
@@ -1359,9 +1354,6 @@ build(){
               if (this.button===1||this.button===2||this.button===3||this.button===4) {
                 this.WarehousingbufferhopperController.open()
               }
-
-
-
             })
         }.width('22%')
         .height('90%')
@@ -1370,7 +1362,7 @@ build(){
       }.width('96%')
       .height('40%')
       Column(){
-        ScanTheOutboundQRCode({scanStorageList:this.scanStorageList})
+        ScanTheOutboundQRCode({scanStorageList:this.scanStorageList,materialNo:this.materialNo})
       }.width('100%')
       .height('54%')
     }

+ 119 - 24
entry/src/main/ets/view/ScanTheOutboundQRCode.ets

@@ -1,16 +1,21 @@
+import { AddAndSubtractComp } from '../common/component/AddAndSubtractComp';
 import StorageRequest from '../common/util/request/StorageRequest';
 import {ScanStorageclass}from './IntelligentWarehousingOutbound'
 
 @CustomDialog
   ///无批次号物料详情弹窗
-struct Outbound {
-  @Link value:number
-  @State private items:Array<ScanStorageclass>=[]
-  @Link CunQuHuo:number
+struct materialDetails {
+  @Link index:number
+  @Link batchCode:string
+  @Link materialName:string
+  // @State materialNo:string=''
+  @Link num:number
+  @Link seqNo:string
+  @Link spec:string
+  @Link  materialNo:string
+  @Link private scanStorageList:Array<ScanStorageclass>
   scroller: Scroller = new Scroller()
   @State navigation:number=0
-  @Link textValue: string
-  @Link inputValue: string
   controller: CustomDialogController
   // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
   cancel: () => void
@@ -39,20 +44,20 @@ struct Outbound {
             .height('20%')
             .fontSize('51px')
           Column({space:10}){
-            Text('PCBA-ASSSD电路板')
+            Text(this.materialName)
               .fontSize('32px')
               .width('100%')
-            Text('100*200')
+            Text('规格描述'+this.spec)
               .fontSize($r('app.float.robot_state_font_size'))
               .textAlign(TextAlign.Start)
               .fontColor('#99000000')
               .width('100%')
-            Text('批次号:'+'1223341232123124121')
+            Text('批次号:'+this.batchCode)
               .fontSize($r('app.float.robot_state_font_size'))
               .textAlign(TextAlign.Start)
               .fontColor('#99000000')
               .width('100%')
-            Text('计划编号:'+'1231231231233')
+            Text('序列号:'+this.seqNo)
               .fontSize($r('app.float.robot_state_font_size'))
               .textAlign(TextAlign.Start)
               .fontColor('#99000000')
@@ -79,18 +84,76 @@ struct Outbound {
               .textAlign(TextAlign.Start)
               .fontColor('#99000000')
               .width('40%')
-            Counter() {
-              Text(this.value.toString())
-
-            }
-            .width('417px')
-            .height('107px')
-            .onInc(() => {
-              this.value++
-            })
-            .onDec(() => {
-              this.value--
+            // Counter() {
+            //   Text(this.num.toString())
+            //
+            // }
+            // .width('417px')
+            // .height('107px')
+            // .onInc(() => {
+            //   this.num++
+            //   this. scanStorageList[this.index]= {
+            //     materialName: this. scanStorageList[this.index].materialName,
+            //     num:this.num,
+            //     materialNo:this. scanStorageList[this.index].materialNo,
+            //     batchCode:this. scanStorageList[this.index].batchCode,
+            //     seqNo:this. scanStorageList[this.index].seqNo,
+            //     spec:this. scanStorageList[this.index].spec,
+            //   }
+            // })
+            // .onDec(() => {
+            //   this.num--
+            //   this. scanStorageList[this.index]= {
+            //     materialName: this. scanStorageList[this.index].materialName,
+            //     num:this.num,
+            //     materialNo:this. scanStorageList[this.index].materialNo,
+            //     batchCode:this. scanStorageList[this.index].batchCode,
+            //     seqNo:this. scanStorageList[this.index].seqNo,
+            //     spec:this. scanStorageList[this.index].spec,
+            //   }
+            // })
+            AddAndSubtractComp({
+              inputNum: this.num,
+              obj:this.scanStorageList[this.index],
+              editPropertyName: 'num',
+              upperLimit: 9999,
+              lowerLimit: 0,
+              addFunction: ()=>{
+                this.num++
+                this. scanStorageList[this.index]= {
+                    materialName: this.scanStorageList[this.index].materialName,
+                    num:this.num,
+                    materialNo:this.scanStorageList[this.index].materialNo,
+                    batchCode:this.scanStorageList[this.index].batchCode,
+                    seqNo:this.scanStorageList[this.index].seqNo,
+                    spec:this.scanStorageList[this.index].spec,
+                  }
+              },
+              subFunction: ()=>{
+                this.num--
+                this. scanStorageList[this.index]= {
+                  materialName: this. scanStorageList[this.index].materialName,
+                  num:this.num,
+                  materialNo:this. scanStorageList[this.index].materialNo,
+                  batchCode:this. scanStorageList[this.index].batchCode,
+                  seqNo:this. scanStorageList[this.index].seqNo,
+                  spec:this. scanStorageList[this.index].spec,
+                }
+              },
+              editFunction:()=>{
+                console.log("444--"+JSON.stringify(this.scanStorageList[this.index]))
+                this.scanStorageList[this.index]= {
+                  materialName: this. scanStorageList[this.index].materialName,
+                  num:this.scanStorageList[this.index].num,
+                  materialNo:this. scanStorageList[this.index].materialNo,
+                  batchCode:this. scanStorageList[this.index].batchCode,
+                  seqNo:this. scanStorageList[this.index].seqNo,
+                  spec:this. scanStorageList[this.index].spec,
+                }
+              }
             })
+              .width('40%')
+              .height('20%')
           }
 
         }.width('50%')
@@ -128,7 +191,7 @@ struct Outbound {
 struct buffer {
   @State num:number=0
   @State materialName:string=''
-  @State itemCode:string='132451234'
+  @Link itemCode:string
   ScanStorageCode= async(itemCode:string) : Promise<ScanStorageclass> => {
     let obj: ScanStorageclass
     let res = await StorageRequest.get("/api/v3/common/scanItem/"+itemCode)
@@ -352,16 +415,24 @@ struct buffer {
 }
 @Component
 export struct ScanTheOutboundQRCode{
+  @State index:number=0
+  @State batchCode:string=''
+  @State materialName:string=''
+ // @State materialNo:string=''
+  @State num:number=0
+  @State seqNo:string=''
+  @State spec:string=''
   @State textValue: string = ''
   @State inputValue: string = ''
   @State value:number=0
   @State ZhuangTai:number=0
   @State CunQuHuo:number=0
+  @Link materialNo:string
   @Link private scanStorageList:Array<ScanStorageclass>
-
   scroller: Scroller = new Scroller()
   MaterialRetrievalController: CustomDialogController = new CustomDialogController({
     builder: buffer({
+      itemCode:this.materialNo,
       scanStorageList:this.scanStorageList,
       CunQuHuo:this.CunQuHuo,
       textValue: $textValue,
@@ -371,6 +442,22 @@ export struct ScanTheOutboundQRCode{
     gridCount: 4,
     customStyle: true,
   })
+  materialDetailsController: CustomDialogController = new CustomDialogController({
+    builder:materialDetails({
+      scanStorageList:this.scanStorageList,
+      index:this.index,
+      batchCode:this.batchCode,
+      materialName:this.materialName,
+      num:this.num,
+      seqNo:this.seqNo,
+      spec:this.spec,
+      materialNo:this.materialNo
+
+    }),
+    alignment: DialogAlignment.Bottom,
+    gridCount: 4,
+    customStyle: true,
+  })
   build(){
     Column(){
       Row(){
@@ -398,7 +485,7 @@ export struct ScanTheOutboundQRCode{
       ///出库列表
       Column({ space: 5 }) {
         Grid(this.scroller) {
-          ForEach(this.scanStorageList, (item:ScanStorageclass) => {
+          ForEach(this.scanStorageList, (item:ScanStorageclass,index:number) => {
             //    ForEach(this.Number, (day: string) => {
             GridItem() {
               Row(){
@@ -437,6 +524,14 @@ export struct ScanTheOutboundQRCode{
               .borderRadius(10)
               .backgroundColor('#fff')
               .onClick(()=>{
+                this.index=index
+                this.batchCode=item.batchCode
+                this.materialName=item.materialName
+                this.materialNo=item.materialNo
+                this.num=item.num
+                this.seqNo=item.seqNo
+                this.spec=item.spec
+                this.materialDetailsController.open()
               })
             }
           })

+ 1 - 1
entry/src/main/ets/view/ScanTheStorageCode.ets

@@ -77,7 +77,7 @@ struct batchNumberPopupBox {
               .textAlign(TextAlign.Start)
               .fontColor('#99000000')
               .width('100%')
-            Text('库单号:'+'1231231231233')
+            Text('库单号:'+'1231231231233')
               .fontSize($r('app.float.robot_state_font_size'))
               .textAlign(TextAlign.Start)
               .fontColor('#99000000')