|
@@ -205,6 +205,85 @@ struct WorkshopPage {
|
|
|
customStyle: true,
|
|
|
})
|
|
|
|
|
|
+ // 停工确认弹窗控制器
|
|
|
+ stopWorkConfirmController: CustomDialogController = new CustomDialogController({
|
|
|
+ builder: confirmDialog({
|
|
|
+ title: '一键停工',
|
|
|
+ cancel: ()=> {},
|
|
|
+ confirm: ()=> {
|
|
|
+ // this.workStatus = 0
|
|
|
+ let times = 0
|
|
|
+ BusinessConstant.stationLightMap.forEach((value, key) => {
|
|
|
+ if (value && value.length === 2) {
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand(value[0], 1)
|
|
|
+ this.issueControlCommand(value[1], 1)
|
|
|
+ }, times * 1000);
|
|
|
+ } else if (value && value.length === 1) {
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand(value[0], 1)
|
|
|
+ }, times * 1000);
|
|
|
+ }
|
|
|
+ times++;
|
|
|
+ });
|
|
|
+ times++;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand('LED3Control', 1)
|
|
|
+ }, times * 1000);
|
|
|
+ times++;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand('LED2Control', 1)
|
|
|
+ }, times * 1000);
|
|
|
+ times++;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand('LED1Control', 1)
|
|
|
+ }, times * 1000);
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ autoCancel: true,
|
|
|
+ alignment: DialogAlignment.Center,
|
|
|
+ // gridCount: 3,
|
|
|
+ customStyle: true,
|
|
|
+ })
|
|
|
+
|
|
|
+ // 开工弹窗控制器
|
|
|
+ startWorkConfirmController: CustomDialogController = new CustomDialogController({
|
|
|
+ builder: confirmDialog({
|
|
|
+ title: '一键开工',
|
|
|
+ cancel: ()=> {},
|
|
|
+ confirm: ()=> {
|
|
|
+ this.issueControlCommand('LED1Control', 0)
|
|
|
+ let times = 1
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand('LED2Control', 0)
|
|
|
+ }, times * 1000);
|
|
|
+ times++;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand('LED3Control', 0)
|
|
|
+ }, times * 1000);
|
|
|
+ times++;
|
|
|
+ BusinessConstant.stationLightMap.forEach((value, key) => {
|
|
|
+ if (value && value.length === 2) {
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand(value[0], 0)
|
|
|
+ this.issueControlCommand(value[1], 0)
|
|
|
+ }, times * 1000);
|
|
|
+ } else if (value && value.length === 1) {
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.issueControlCommand(value[0], 0)
|
|
|
+ }, times * 1000);
|
|
|
+ }
|
|
|
+ times++;
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ autoCancel: true,
|
|
|
+ alignment: DialogAlignment.Center,
|
|
|
+ // gridCount: 3,
|
|
|
+ customStyle: true,
|
|
|
+ })
|
|
|
+
|
|
|
build() {
|
|
|
Column() {
|
|
|
// 顶部状态栏
|
|
@@ -335,7 +414,11 @@ struct WorkshopPage {
|
|
|
.onChange((isOn: boolean) => {
|
|
|
let controlStr = BusinessConstant.stationLightMap.get(item.stationName);
|
|
|
if (controlStr && controlStr.length > 0) {
|
|
|
- this.issueControlCommand(controlStr[0], isOn ? 0 : 1);
|
|
|
+ if (item.stationType! === 1) {
|
|
|
+ this.issueControlCommand(controlStr[0], isOn ? 0 : 1);
|
|
|
+ } else {
|
|
|
+ this.issueControlCommand(controlStr[0], isOn ? 1 : 0);
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -484,30 +567,7 @@ struct WorkshopPage {
|
|
|
.backgroundColor($r('app.color.10FFFFFF'))
|
|
|
.borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
.onClick(()=>{
|
|
|
- // this.workStatus = 1
|
|
|
- this.issueControlCommand('LED1Control', 0)
|
|
|
- let times = 1
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand('LED2Control', 0)
|
|
|
- }, times * 1000);
|
|
|
- times++;
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand('LED3Control', 0)
|
|
|
- }, times * 1000);
|
|
|
- times++;
|
|
|
- BusinessConstant.stationLightMap.forEach((value, key) => {
|
|
|
- if (value && value.length === 2) {
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand(value[0], 0)
|
|
|
- this.issueControlCommand(value[1], 0)
|
|
|
- }, times * 1000);
|
|
|
- } else if (value && value.length === 1) {
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand(value[0], 0)
|
|
|
- }, times * 1000);
|
|
|
- }
|
|
|
- times++;
|
|
|
- });
|
|
|
+ this.startWorkConfirmController.open()
|
|
|
})
|
|
|
// 一键停工
|
|
|
Row() {
|
|
@@ -533,33 +593,7 @@ struct WorkshopPage {
|
|
|
.backgroundColor($r('app.color.10FFFFFF'))
|
|
|
.borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
.onClick(()=>{
|
|
|
- // this.workStatus = 0
|
|
|
- let times = 0
|
|
|
- BusinessConstant.stationLightMap.forEach((value, key) => {
|
|
|
- if (value && value.length === 2) {
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand(value[0], 1)
|
|
|
- this.issueControlCommand(value[1], 1)
|
|
|
- }, times * 1000);
|
|
|
- } else if (value && value.length === 1) {
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand(value[0], 1)
|
|
|
- }, times * 1000);
|
|
|
- }
|
|
|
- times++;
|
|
|
- });
|
|
|
- times++;
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand('LED3Control', 1)
|
|
|
- }, times * 1000);
|
|
|
- times++;
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand('LED2Control', 1)
|
|
|
- }, times * 1000);
|
|
|
- times++;
|
|
|
- setTimeout(()=>{
|
|
|
- this.issueControlCommand('LED1Control', 1)
|
|
|
- }, times * 1000);
|
|
|
+ this.stopWorkConfirmController.open()
|
|
|
})
|
|
|
|
|
|
// 电源功耗
|
|
@@ -1358,6 +1392,82 @@ struct robotInfoDialog {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 确认弹窗
|
|
|
+@CustomDialog
|
|
|
+struct confirmDialog {
|
|
|
+
|
|
|
+ // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
|
|
|
+ controller?: CustomDialogController
|
|
|
+ cancel?: () => void = () => {
|
|
|
+ }
|
|
|
+ confirm: () => void = () => {
|
|
|
+ }
|
|
|
+
|
|
|
+ @State title: string = ''
|
|
|
+
|
|
|
+ build() {
|
|
|
+ Column() {
|
|
|
+ Row() {
|
|
|
+ Text(this.title)
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize($r('app.float.fontSize_38'))
|
|
|
+ .fontColor($r('app.color.FFFFFF'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ }
|
|
|
+ .height('30%')
|
|
|
+ .width('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+
|
|
|
+ Blank()
|
|
|
+ Divider().vertical(false).color($r('app.color.FFFFFF'))
|
|
|
+ .width('100%')
|
|
|
+ .opacity(0.15)
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ Row() {
|
|
|
+ Text('取消')
|
|
|
+ .fontColor($r('app.color.60FFFFFF'))
|
|
|
+ .fontSize($r('app.float.fontSize_12'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ }
|
|
|
+ .width('50%')
|
|
|
+ .height('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .onClick(()=>{
|
|
|
+ if (this.controller != undefined) {
|
|
|
+ this.controller.close()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ Divider().vertical(true).color($r('app.color.FFFFFF'))
|
|
|
+ .height('100%')
|
|
|
+ .opacity(0.15)
|
|
|
+ Row() {
|
|
|
+ Text('确认')
|
|
|
+ .fontColor($r('app.color.007AFF'))
|
|
|
+ .fontSize($r('app.float.fontSize_12'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ }
|
|
|
+ .width('50%')
|
|
|
+ .height('100%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .onClick(()=>{
|
|
|
+ this.confirm();
|
|
|
+ if (this.controller != undefined) {
|
|
|
+ this.controller.close()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('100%')
|
|
|
+ .height('50%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ }
|
|
|
+ .width('25%')
|
|
|
+ .height('30%')
|
|
|
+ .backgroundColor($r('app.color.2A2A2A'))
|
|
|
+ .borderRadius($r('app.float.virtualSize_6_4'))
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 工位控制
|
|
|
class StationControl {
|
|
|
// 设备名称
|