|
@@ -24,7 +24,7 @@ import { ReportWorkNumDialog } from '../view/ReportWorkNumDialog';
|
|
|
import { ProcessReportingDialog } from '../view/ProcessReportingDialog';
|
|
|
import { JoinPersonNameDialog } from '../view/JoinPersonNameDialog';
|
|
|
import ReportInfo from '../viewmodel/ReportInfo';
|
|
|
-import { BindTaskSeqVO } from '../viewmodel/BindTaskSeqVO';
|
|
|
+import { BindTaskSeqVO } from '../viewmodel/process/BindTaskSeqVO';
|
|
|
import { MqttClientOptions, MqttConnectOptions } from '@ohos/mqtt';
|
|
|
import MqttManager from '../common/util/mqtt';
|
|
|
import { DefectNumReportDialog } from '../view/DefectNumReportDialog';
|
|
@@ -68,6 +68,8 @@ struct ProcessIndex {
|
|
|
@State isAuxiliaryViewOpen:boolean = false
|
|
|
// 选中工序id
|
|
|
@State selectOperationId: string = ''
|
|
|
+ // 绩效模式(0:计时 1:计件)
|
|
|
+ @State operationPerformance: string = ''
|
|
|
// 选中工序名称
|
|
|
selectOperationName: string = ''
|
|
|
//选择的按钮索引(默认加载全部)
|
|
@@ -90,12 +92,14 @@ struct ProcessIndex {
|
|
|
['6', $r('app.media.process_component_device_record')],
|
|
|
['7', $r('app.media.process_component_fastening')],
|
|
|
['9', $r('app.media.process_component_label_bind')],
|
|
|
- ['10', $r('app.media.process_component_self_inspect')],
|
|
|
+ ['10', $r('app.media.process_component_form')],
|
|
|
+ ['11', $r('app.media.process_component_auto_test')],
|
|
|
+ ['12', $r('app.media.process_component_device_record')],
|
|
|
])
|
|
|
// 扫码开工后的生产过程信息
|
|
|
@State process: ProcessInfo = {}
|
|
|
// 扫码开工状态(0:未开工 1:已开工)
|
|
|
- @State scanState: number = 0
|
|
|
+ @State @Watch('queryByScanState') scanState: number = 0
|
|
|
// 工单下流转卡号列表
|
|
|
@State seqList: WorkOrderSeq[] = []
|
|
|
// 设备每日点检
|
|
@@ -112,11 +116,12 @@ struct ProcessIndex {
|
|
|
@Provide('currentStationId') @Watch('refreshWorkOrder') currentStationId: string = ''
|
|
|
@Provide('currentUserName') currentUserName: string =''
|
|
|
@Provide('currentUserId') currentUserId: number = 0
|
|
|
+ // 报工人、报工流水号和不良流水号
|
|
|
@Provide('bindTaskSeq') bindTaskSeq: BindTaskSeqVO[] = []
|
|
|
@State reportList: ReportInfo[] = []
|
|
|
@State currentReporterIndex:number =0
|
|
|
@State currentReportNumIndex:number =0
|
|
|
- @State currentUnqualifiedIndex:number =0
|
|
|
+ @State currentDefectIndex:number =0
|
|
|
// mqtt是否连接
|
|
|
@State isConnected: boolean = false
|
|
|
// 工位发生改变则可能需要重新选择工单
|
|
@@ -152,6 +157,14 @@ struct ProcessIndex {
|
|
|
console.log('hhtest', '选择工单被清空-----------------')
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ async queryByScanState() {
|
|
|
+ if (this.scanState === 1) {
|
|
|
+ await this.scanCodeToStartWork()
|
|
|
+ } else {
|
|
|
+ await this.getComponentsForNotStartWork()
|
|
|
+ }
|
|
|
+ }
|
|
|
// 扫码开工
|
|
|
async scanCodeToStartWork() {
|
|
|
this.process = await ProcessRequest.post('/api/v1/process/info/scan', {
|
|
@@ -182,7 +195,6 @@ struct ProcessIndex {
|
|
|
sortNum:0
|
|
|
})
|
|
|
}
|
|
|
- this.scanState = 1
|
|
|
// 保存此流转卡号到数据库中
|
|
|
let seqNos: string[] = []
|
|
|
seqNos = await preferencesUtil.get(CommonConstants.PREFERENCE_INSTANCE_NAME, this.selectWorkOder.workOrderCode!, seqNos)
|
|
@@ -287,6 +299,7 @@ struct ProcessIndex {
|
|
|
}
|
|
|
|
|
|
onPageShow() {
|
|
|
+ console.log('hhtest', '------------------------------')
|
|
|
const params = router.getParams() as Params; // 获取传递过来的参数对象
|
|
|
if (params && params.auxiliaryOperationFlag) {
|
|
|
this.isAuxiliaryViewOpen = true
|
|
@@ -344,7 +357,7 @@ struct ProcessIndex {
|
|
|
this.currentStationId = '66'
|
|
|
this.currentStation = '装配工位'
|
|
|
let res:UserInfo = await ProcessRequest.get('/api/auth') ;
|
|
|
- this.currentUserId = res.id!
|
|
|
+ this.currentUserId = res.id! as number
|
|
|
// ---------------删除以上内容------------------
|
|
|
}
|
|
|
|
|
@@ -545,6 +558,7 @@ struct ProcessIndex {
|
|
|
}
|
|
|
this.selectOperationId = item.operationId!
|
|
|
this.selectOperationName = item.operationName!
|
|
|
+ this.operationPerformance = item.performance!
|
|
|
if (!item.exists) {
|
|
|
promptAction.showToast({
|
|
|
message: `${item.operationName}需要在${item.stationName}工位上生产`,
|
|
@@ -975,7 +989,8 @@ struct ProcessIndex {
|
|
|
return
|
|
|
}
|
|
|
if (this.scanState === 0) {
|
|
|
- this.scanCodeToStartWork()
|
|
|
+ this.scanState = 1
|
|
|
+ // this.scanCodeToStartWork()
|
|
|
} else if (this.scanState === 1) {
|
|
|
this.processReportingController.open()
|
|
|
}
|
|
@@ -1085,6 +1100,8 @@ struct ProcessIndex {
|
|
|
loginInfoController: CustomDialogController = new CustomDialogController({
|
|
|
builder: LoginInfoDialog({
|
|
|
scanState: this.scanState,
|
|
|
+ opComponents: this.opComponents,
|
|
|
+ selectComponentType: this.selectComponentType,
|
|
|
searchDept:()=>{this.SwitchingDeptController.open()},
|
|
|
searchStation:()=>{this.SwitchingStationController.open()},
|
|
|
searchProductLine:()=>{this.SwitchingProductLineController.open()},
|
|
@@ -1124,9 +1141,9 @@ struct ProcessIndex {
|
|
|
// 工序报工-不良品报工弹窗
|
|
|
defectNumReportController: CustomDialogController = new CustomDialogController({
|
|
|
builder: DefectNumReportDialog({
|
|
|
- userName: this.reportList[this.currentUnqualifiedIndex].userName,
|
|
|
+ userName: this.reportList[this.currentDefectIndex].userName,
|
|
|
onConfirm:(num:number)=>{
|
|
|
- const index = this.currentUnqualifiedIndex;
|
|
|
+ const index = this.currentDefectIndex;
|
|
|
if (this.reportList[index]) {
|
|
|
this.reportList[index].defectNum = String(num);
|
|
|
this.reportList = [...this.reportList];
|
|
@@ -1142,24 +1159,7 @@ struct ProcessIndex {
|
|
|
JoinPersonNameController: CustomDialogController = new CustomDialogController({
|
|
|
builder: JoinPersonNameDialog({
|
|
|
reportList:this.reportList,
|
|
|
- onConfirm:(name:string)=>{
|
|
|
- const nameExists = this.reportList.some(item =>
|
|
|
- item.userName && name &&
|
|
|
- item.userName.toString().toLowerCase() === name.toString().toLowerCase().trim()
|
|
|
- );
|
|
|
- if (nameExists) {
|
|
|
- promptAction.showToast({
|
|
|
- message: '该用户已添加,请添加其他用户!',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- const index = this.currentReporterIndex;
|
|
|
- if (this.reportList[index]) {
|
|
|
- this.reportList[index].userName = name;
|
|
|
- this.reportList = [...this.reportList];
|
|
|
- }
|
|
|
- }
|
|
|
+ currentReporterIndex:this.currentReporterIndex,
|
|
|
}),
|
|
|
autoCancel: true,
|
|
|
customStyle: true,
|
|
@@ -1184,7 +1184,7 @@ struct ProcessIndex {
|
|
|
this.currentReportNumIndex = index
|
|
|
this.ReportWorkNumController.open()
|
|
|
},
|
|
|
- onSelectUnqualified:(index:number)=>{
|
|
|
+ onSelectDefectNum:(index:number)=>{
|
|
|
if (!this.reportList[index]?.userName?.trim()) {
|
|
|
promptAction.showToast({
|
|
|
message: '请先添加用户',
|
|
@@ -1192,13 +1192,18 @@ struct ProcessIndex {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- this.currentUnqualifiedIndex = index
|
|
|
+ this.currentDefectIndex = index
|
|
|
this.defectNumReportController.open()
|
|
|
},
|
|
|
+ clearSelectData:()=>{
|
|
|
+ this.clearSelectData()
|
|
|
+ },
|
|
|
reportList:this.reportList,
|
|
|
selectWorkOder: this.selectWorkOder,
|
|
|
selectOperationName: this.selectOperationName,
|
|
|
- selectOperationId: this.selectOperationId
|
|
|
+ selectOperationId: this.selectOperationId,
|
|
|
+ process: this.process,
|
|
|
+ operationPerformance: this.operationPerformance,
|
|
|
}),
|
|
|
autoCancel: true,
|
|
|
customStyle: true,
|