huhao@jgai.com преди 2 дни
родител
ревизия
899d471638

+ 5 - 5
build-profile.json5

@@ -4,13 +4,13 @@
       {
         "name": "default",
         "material": {
-          "certpath": "C:/Users/cjb/.ohos/config/openharmony/default_wms_o9y0zjd-xwhUhosv8ZiIU_cQf5mawkMyLRnydUda52I=.cer",
-          "storePassword": "0000001B21F5009610951D4806650B18441FD527694DCE8DEE4904408FA2C1B258DCC181FE6E5E481B64CF",
+          "certpath": "C:/Users/67381/.ohos/config/openharmony/default_wms_68CIINnIbxiWeEXXMiK5xFz9TtRPOiq6KrQ7DAOP0_M=.cer",
+          "storePassword": "0000001A014D271C2E057EC5C6C964A27ACED759C3345583356596F342A87481E2B2AEF1BC5D6171A3F0",
           "keyAlias": "debugKey",
-          "keyPassword": "0000001B85D453B3AB57A3A6F2AEB2B17F5BA26B87290688ABEA0B55863C5CE8741125CD3C5F908F25759D",
-          "profile": "C:/Users/cjb/.ohos/config/openharmony/default_wms_o9y0zjd-xwhUhosv8ZiIU_cQf5mawkMyLRnydUda52I=.p7b",
+          "keyPassword": "0000001AFEC40F07F84FB29D3ADF38D87A72BDAA84973BDF7658623686A0E8460B63FB39FFE6161ECB0C",
+          "profile": "C:/Users/67381/.ohos/config/openharmony/default_wms_68CIINnIbxiWeEXXMiK5xFz9TtRPOiq6KrQ7DAOP0_M=.p7b",
           "signAlg": "SHA256withECDSA",
-          "storeFile": "C:/Users/cjb/.ohos/config/openharmony/default_wms_o9y0zjd-xwhUhosv8ZiIU_cQf5mawkMyLRnydUda52I=.p12"
+          "storeFile": "C:/Users/67381/.ohos/config/openharmony/default_wms_68CIINnIbxiWeEXXMiK5xFz9TtRPOiq6KrQ7DAOP0_M=.p12"
         }
       }
     ],

+ 4 - 1
entry/oh-package.json5

@@ -5,6 +5,9 @@
   "main": "",
   "author": "",
   "license": "",
-  "dependencies": {}
+  "dependencies": {
+    "@mcui/mccharts": "^1.0.2",
+    "@ohos/axios": "2.2.1-rc.0"
+  }
 }
 

+ 72 - 0
entry/src/main/ets/common/util/request/WmsRequest.ets

@@ -0,0 +1,72 @@
+import axios, {
+  AxiosError,
+  AxiosResponse,
+  AxiosRequestHeaders,
+  AxiosRequestConfig,
+  CreateAxiosDefaults,
+  InternalAxiosRequestConfig
+} from '@ohos/axios';
+import { printError, printRequest, printResponse, handleRes } from './Helps';
+
+
+// jiaxiaoqiang:这里要改
+const baseUrl = "http://192.168.1.3:11011/" //xianfeng
+// const baseUrl = "http://192.168.1.4:8079/" //chuangke
+const DEBUG = true //
+
+// 创建实例
+const WmsRequest = axios.create(
+
+  {
+    baseURL: baseUrl,
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8',
+    },
+    timeout: 60 * 1000,
+  }
+)
+
+// 添加请求拦截器
+WmsRequest.interceptors.request.use((config: InternalAxiosRequestConfig) => {
+
+  // 以后登录之后可以在这里传
+  // config.headers.Authorization = CommonConstants.AUTH_TOKEN
+  // config.headers.Authorization ="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOnsiaWQiOjM3LCJsb2dpblR5cGUiOiJhaW8ifSwiZGV2aWNlIjoiYWlvIiwiZWZmIjoxNzE3NTExMjYwODI4LCJyblN0ciI6InRSenNBTGdlZ3lqS0FHeDZTSkdYZTNLbFY3eWh1OG1PIn0.FVAeESiz_PH1NtBFDmGZr0IwtXzubV2d8JTQdGdJnxc"
+  printRequest(config)
+  return config;
+}, (error: AxiosError) => {
+  // 对请求错误做些什么
+  printError(error)
+  return Promise.reject(error);
+});
+
+
+// 添加响应拦截器
+WmsRequest.interceptors.response.use((response: AxiosResponse) => {
+  console.log("hhtest", "---------------------------")
+  // 对响应数据做点什么
+  printResponse(response)
+  let res = handleRes(response)
+  let success = res[0] as boolean
+  let msg = res[1] as string
+  console.debug("handleRes的返回结果 ", success, msg)
+
+  if (success) {
+    return response.data.data;
+  }
+  else {
+    return Promise.reject<string>(msg)
+  }
+
+}, (error: AxiosError) => {
+  // 对响应错误做点什么
+  printError(error)
+
+  return Promise.reject(error);
+});
+
+export default WmsRequest;
+
+
+
+

+ 108 - 0
entry/src/main/ets/common/util/request/helps.ets

@@ -0,0 +1,108 @@
+import { InternalAxiosRequestConfig, AxiosResponse, AxiosError } from "@ohos/axios"
+import promptAction from '@ohos.promptAction'
+
+// 是否在控制台打印某项log
+const pConfig = false
+const pHeaders = false
+const pUrl = true
+const pParams = true
+const pBody = true
+const pResponse = true
+const pData = true
+const pError = true
+
+// @CustomDialog
+// struct CustomDialogExample {
+//   controller: CustomDialogController
+//   build() {
+//     Column() {
+//       Text('我是内容')
+//         .fontSize(20)
+//         .margin({ top: 10, bottom: 10 })
+//     }
+//   }
+// }
+
+const printRequest = (config: InternalAxiosRequestConfig) => {
+  if (pConfig) {
+    console.debug("printRequest config", JSON.stringify(config))
+  }
+
+  if (pHeaders) {
+    console.debug("printRequest headers", JSON.stringify(config.headers))
+  }
+
+  if (pUrl) {
+    console.debug("printRequest url", `Method:${config.method} ${config.baseURL}${config.url}`)
+  }
+
+  if (pBody) {
+    console.debug("printRequest 请求参数data", JSON.stringify(config.data))
+  }
+
+  if (pParams) {
+    console.debug("printRequest 请求参数params", JSON.stringify(config.params))
+  }
+
+}
+
+const printResponse = (response: AxiosResponse) => {
+  if (pResponse) {
+    console.debug('printResponse response: ', JSON.stringify(response))
+  }
+  if (pData) {
+    console.debug("printResponse data", JSON.stringify(response.data))
+  }
+}
+
+const printError = (error: AxiosError) => {
+  if (pError) {
+    console.debug("printError error", error.message)
+  }
+  promptAction.showToast({
+    message: error.message ?? "请求出错",
+    duration: 1500,
+    bottom: 100
+  })
+}
+
+
+// 处理返回数据
+const handleRes = (response: AxiosResponse): [boolean, string] => {
+  let isSuccess = true
+  let msg = ""
+
+  if (response.status === 200) { //判断返回状态是否为200
+    if (String(response.data?.code) === "200") { //判断数据的code是否为200,有可能是500的服务器错误
+      isSuccess = true
+      msg = `请求数据成功`
+    }
+    else {
+      isSuccess = false
+      // msg = `${response.data?.code}: ${response.data?.msg ?? "服务器错误"}`
+      msg = `${response.data?.msg ?? "服务器错误"}`
+    }
+  }
+  else {
+    isSuccess = false
+    msg = `状态码非200 status: ${response.status}}`
+  }
+
+  if (!isSuccess) {
+    promptAction.showToast({
+      message: msg,
+      duration: 2000,
+      bottom: 100
+    })
+
+    // const dialogController: CustomDialogController = new CustomDialogController({
+    //   builder: CustomDialogExample({}),
+    // })
+    // dialogController.open()
+  }
+
+  return [isSuccess, msg]
+}
+
+
+export { printRequest, printResponse, printError, handleRes }

+ 147 - 0
entry/src/main/ets/pages/ProcessMaterialKit.ets

@@ -0,0 +1,147 @@
+/*
+ * 工序齐套
+ * */
+import { TimeAndTitle } from '../component/TimeAndTitle'
+import router from '@ohos.router'
+import { NavigationBar } from '../component/NavigationBar'
+import { ProcessMaterialKitOneStep } from '../view/wms/ProcessMaterialKitOneStep'
+import WorkOrderInfo from '../viewmodel/wms/WorkOrderInfo'
+
+@Entry
+@Component
+struct ProcessMaterialKit {
+
+  @State step: number = 1
+  // 选中的工单
+  @State workOrder: WorkOrderInfo = {}
+
+  build() {
+    Column() {
+      // 顶部时间和菜单栏
+      Row(){
+        TimeAndTitle()
+      }
+      .width('100%')
+      .height('3.5%')
+      .alignItems(VerticalAlign.Bottom)
+      .justifyContent(FlexAlign.End)
+
+      // 工序齐套
+      Row() {
+        Image($r('app.media.general_return'))
+          .height($r('app.float.virtualSize_22_4'))
+          .width($r('app.float.virtualSize_22_4'))
+          .fillColor($r('app.color.FFFFFF'))
+          .onClick(()=> {
+            router.back()
+          })
+
+        Text('工序齐套')
+          .fontSize($r('app.float.fontSize_12'))
+          .fontColor($r('app.color.FFFFFF'))
+          .fontWeight(FontWeight.Medium)
+      }
+      .width('94.8%')
+      .height('5.2%')
+      .alignItems(VerticalAlign.Center)
+      .justifyContent(FlexAlign.Start)
+
+      // 齐套步骤和操作栏
+      Row() {
+        Row().width('41%')
+        Row() {
+          Stack() {
+            Circle()
+              .width($r('app.float.virtualSize_19_2'))
+              .height($r('app.float.virtualSize_19_2'))
+              .fill(this.step === 1 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
+            Text('1')
+              .fontSize($r('app.float.fontSize_12'))
+              .fontColor(this.step === 1 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+              .fontWeight(FontWeight.Medium)
+          }
+          .width($r('app.float.virtualSize_19_2'))
+          .height($r('app.float.virtualSize_19_2'))
+
+          Stack() {
+            Circle()
+              .width($r('app.float.virtualSize_19_2'))
+              .height($r('app.float.virtualSize_19_2'))
+              .fill(this.step === 2 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
+            Text('2')
+              .fontSize($r('app.float.fontSize_12'))
+              .fontColor(this.step === 2 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+              .fontWeight(FontWeight.Medium)
+          }
+          .width($r('app.float.virtualSize_19_2'))
+          .height($r('app.float.virtualSize_19_2'))
+
+          Stack() {
+            Circle()
+              .width($r('app.float.virtualSize_19_2'))
+              .height($r('app.float.virtualSize_19_2'))
+              .fill(this.step === 3 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
+            Text('3')
+              .fontSize($r('app.float.fontSize_12'))
+              .fontColor(this.step === 3 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+              .fontWeight(FontWeight.Medium)
+          }
+          .width($r('app.float.virtualSize_19_2'))
+          .height($r('app.float.virtualSize_19_2'))
+        }
+        .height('100%')
+        .width('18%')
+        .justifyContent(FlexAlign.SpaceBetween)
+        Blank()
+
+        Row() {
+          NavigationBar()
+        }
+        .height('100%')
+        .width('30%')
+      }
+      .width('100%')
+      .height('5.2%')
+      .alignItems(VerticalAlign.Center)
+      .justifyContent(FlexAlign.Center)
+
+      Row() {
+        Row() {
+          Text('选择工序')
+            .fontSize($r('app.float.fontSize_6_4'))
+            .fontColor(this.step === 1 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+            .fontWeight(FontWeight.Regular)
+          Text('齐套装箱')
+            .fontSize($r('app.float.fontSize_6_4'))
+            .fontColor(this.step === 2 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+            .fontWeight(FontWeight.Regular)
+          Text('齐套入库')
+            .fontSize($r('app.float.fontSize_6_4'))
+            .fontColor(this.step === 3 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+            .fontWeight(FontWeight.Regular)
+        }
+        .height('100%')
+        .width('18%')
+        .justifyContent(FlexAlign.SpaceBetween)
+      }
+      .width('100%')
+      .height('1.4%')
+      .alignItems(VerticalAlign.Center)
+      .justifyContent(FlexAlign.Center)
+
+      Column() {
+        if (this.step === 1) {
+          ProcessMaterialKitOneStep({
+            workOrder: this.workOrder
+          })
+        }
+      }
+      .height('71%')
+      .width('94.8%')
+
+    }
+    .width('100%')
+    .height('100%')
+    .backgroundColor($r('app.color.000000'))
+  }
+}

+ 58 - 0
entry/src/main/ets/view/wms/ProcessMaterialKitOneStep.ets

@@ -0,0 +1,58 @@
+import WmsRequest from '../../common/util/request/WmsRequest'
+import RequestParamModel from '../../viewmodel/wms/RequestParamModel'
+import WorkOrderInfo from '../../viewmodel/wms/WorkOrderInfo'
+
+@Component
+export struct ProcessMaterialKitOneStep {
+
+  @Link workOrder: WorkOrderInfo
+
+  @State workOrderArray: WorkOrderInfo[] = []
+
+  @State selectWorkOrder: number = 0
+
+  async aboutToAppear() {
+    this.workOrderArray = await WmsRequest.post('/api/v1/plan/workOrder/list', {
+      //查询未完成的工单
+      queryComplete: 0,
+    } as RequestParamModel) as WorkOrderInfo[]
+    if (this.workOrderArray && this.workOrderArray.length > 0) {
+      this.workOrder = this.workOrderArray[0]
+      this.selectWorkOrder = 0
+    }
+  }
+
+  build() {
+    Row() {
+      Column() {
+        Row() {
+          Text('选择工单')
+            .fontSize($r('app.float.fontSize_12'))
+            .fontColor($r('app.color.FFFFFF'))
+            .fontWeight(FontWeight.Medium)
+        }
+        .height('10%')
+        .width('29.6%')
+        .justifyContent(FlexAlign.Center)
+
+        List() {
+          ForEach(this.workOrderArray, (item: WorkOrderInfo, index: number) => {
+            ListItem() {
+              Column() {
+
+              }
+              .height('15.4%')
+              .backgroundColor(this.selectWorkOrder === index ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
+            }
+          })
+        }
+        .width('100%')
+        .height('90%')
+      }
+
+    }
+    .width('100%')
+    .height('100%')
+    .justifyContent(FlexAlign.SpaceBetween)
+  }
+}

+ 6 - 0
entry/src/main/ets/viewmodel/wms/RequestParamModel.ets

@@ -0,0 +1,6 @@
+//通用请求后台参数
+export default class RequestParamModel {
+  // 工单状态 0 未完成 1已完成
+  queryComplete?: number
+
+}

+ 56 - 0
entry/src/main/ets/viewmodel/wms/WorkOrderInfo.ets

@@ -0,0 +1,56 @@
+export default class WorkOrderInfo{
+  // 工单编码
+  workOrderCode?: string
+  // 工单id
+  orderId?: number
+  // 订单编码
+  orderCode?: string
+  // 订单名称
+  orderName?: string
+  // 物料编号
+  materialCode?: string
+  // 物料名称
+  materialName?: string
+  // 物料型号
+  materialModel?: string
+  // 工艺版本
+  processRouteVersion?: string
+  // 优先级
+  priority?: string
+  // 产线id
+  productLineId?: string
+  // 产线名称
+  productLineName?: string
+  //工艺路线id
+  processRouteId?: string
+  // 工艺路线编码
+  processRouteCode?: string
+  // 工艺路线名称
+  processRouteName?: string
+  // 计划开始时间
+  planStartWhen?: string
+  // 计划结束时间
+  planStartEnd?: string
+  // 生产车间id
+  workshopId?: string
+  // 生产车间名
+  workshopName?: string
+  // 计划数量
+  planNum?: string
+  // 完成数量
+  completeNum?: string
+  // 报废数量
+  scrapNum?: string
+  // 入库数量
+  inventoryNum?: string
+  // 提前下线数量
+  beforeNum?: string
+  // 工单状态
+  workOrderState?: string
+  // 物料分配状态
+  itemAllotState?: number
+  orderType?: string
+  // 数据包地址
+  packageUrl?: string
+  engineeringCode?: string
+}

+ 5 - 0
entry/src/main/module.json5

@@ -32,6 +32,11 @@
           }
         ]
       }
+    ],
+    "requestPermissions":[
+      {
+        "name": "ohos.permission.INTERNET"
+      }
     ]
   }
 }

+ 4 - 0
entry/src/main/resources/base/element/color.json

@@ -107,6 +107,10 @@
     {
       "name": "40FFFFFF",
       "value": "#66FFFFFF"
+    },
+    {
+      "name": "2030D158",
+      "value": "#3330D158"
     }
   ]
 }

+ 4 - 0
entry/src/main/resources/base/element/font.json

@@ -71,6 +71,10 @@
     {
       "name": "virtualSize_40",
       "value": "60vp"
+    },
+    {
+      "name": "virtualSize_22_4",
+      "value": "33.6vp"
     }
   ]
 }

+ 1 - 0
entry/src/main/resources/base/profile/main_pages.json

@@ -3,6 +3,7 @@
     "pages/LoginPage",
     "pages/EmptyBoxStorage",
     "pages/OrderMaterialsStorage",
+    "pages/ProcessMaterialKit",
     "pages/Menu"
   ]
 }

+ 1 - 0
oh-package.json5

@@ -6,6 +6,7 @@
   "author": "",
   "license": "",
   "dependencies": {
+    "@ohos/mqtt": "^2.0.6"
   },
   "devDependencies": {
     "@ohos/hypium": "1.0.13"