ProcessIndex.ets 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300
  1. import { TimeAndTitle } from '../common/component/TimeAndTitle';
  2. import router from '@ohos.router';
  3. import WorkOrderInfo from '../viewmodel/WorkOrderInfo';
  4. import CommonConstants from '../common/constants/CommonConstants';
  5. import ProcessRequest from '../common/util/request/ProcessRequest';
  6. import RequestParamModel from '../viewmodel/RequestParamModel';
  7. import OperationInfo from '../viewmodel/process/OperationInfo';
  8. import { SelectWorkOrderDialog } from '../view/SelectWorkOrderDialog';
  9. import { SwitchingProductDialog, taskSeqItem } from '../view/SwitchingProductDialog';
  10. import TaskSeqVO from '../viewmodel/process/TaskSeqInfo';
  11. import promptAction from '@ohos.promptAction';
  12. import { LoginInfoDialog } from '../view/LoginInfoDialog';
  13. import { SwitchingDeptDialog, SwitchingProductLineDialog, SwitchingStationDialog } from '../view/SwitchingStationViews';
  14. import { SwitchingUserDialog } from '../view/SwitchingUserDialog';
  15. import OperationComponent from '../viewmodel/process/OperationComponent';
  16. import ProcessInfo from '../viewmodel/process/ProcessInfo';
  17. import { MaterialCollectView } from '../view/process/MaterialCollectView';
  18. import { WorkOrderPage } from '../viewmodel/WorkOrderPage';
  19. import { UserInfo } from '../viewmodel/UserInfo';
  20. import { CompleteReceiveDialog } from '../view/CompleteReceiveDialog';
  21. import { WorkInstructionsDialog } from '../view/WorkInstructionsDialog';
  22. import connection from '@ohos.net.connection';
  23. import { ReportWorkNumDialog } from '../view/ReportWorkNumDialog';
  24. import { ProcessReportingDialog } from '../view/ProcessReportingDialog';
  25. import { JoinPersonNameDialog } from '../view/JoinPersonNameDialog';
  26. import ReportInfo from '../viewmodel/ReportInfo';
  27. import { BindTaskSeqVO } from '../viewmodel/BindTaskSeqVO';
  28. import { MqttClientOptions, MqttConnectOptions } from '@ohos/mqtt';
  29. import MqttManager from '../common/util/mqtt';
  30. import { UnqualifiedReportDialog } from '../view/UnqualifiedReportDialog';
  31. import { SelfInspectView } from '../view/process/SelfInspectView';
  32. import { MultiMediaCollect } from '../view/process/MultiMediaCollect';
  33. import { BarcodeAssociationDialog } from '../view/BarcodeAssociationDialog';
  34. import WorkOrderSeq from '../viewmodel/WorkOrderSeq';
  35. import { USBDeviceManager } from '../common/util/UsbDevice';
  36. import { InAndOutBoundDialog } from '../view/InAndOutBoundDialog';
  37. import { LittleMaterialRequestDialog } from '../view/LittleMaterialRequestDialog';
  38. import { PictureDrawingDialog } from '../view/PictureDrawingDialog';
  39. import { AuxiliaryOperationView } from '../view/AuxiliaryOperationView';
  40. import { BusinessError } from '@ohos.base';
  41. import window from '@ohos.window';
  42. import { DeviceInspectionDialog } from '../view/DeviceInspectionDialog';
  43. import preferencesUtil from '../common/util/PerferencesUtil';
  44. import TimeUtil from '../common/util/TimeUtil';
  45. import ProcessDeviceDailyCheck from '../viewmodel/process/ProcessDeviceDailyCheck';
  46. import { DeviceCheckView } from '../view/process/DeviceCheckView';
  47. // 声明接受参数的类型
  48. interface Params {
  49. // 辅助操作标志
  50. auxiliaryOperationFlag?: boolean,
  51. }
  52. @Entry
  53. @Component
  54. struct ProcessIndex {
  55. // 工单列表
  56. @State workOrders: WorkOrderInfo[] = []
  57. // 选中工单
  58. @State selectWorkOder: WorkOrderInfo = {}
  59. // 工位通知数量
  60. @State noticeNum: number = 100
  61. // 扫描或手动输入的流水/序列/铭牌号
  62. @State scanCode: string = ''
  63. // 当前流转卡号
  64. @State seqNo: string = ''
  65. //是否打开底部抽屉
  66. @State isAuxiliaryViewOpen:boolean = false
  67. // 选中工序id
  68. @State selectOperationId: string = ''
  69. // 选中工序名称
  70. selectOperationName: string = ''
  71. //选择的按钮索引(默认加载全部)
  72. @State selectedButtonIndex: number = 0
  73. // 流转卡号信息集合
  74. @State taskSeqArray: TaskSeqVO[] = []
  75. // 工序组件(工步)
  76. @State opComponents: OperationComponent[] = []
  77. // 选中的工序组件类型
  78. @State selectComponentType: string = ''
  79. // 工序组件状态数组(0:未完成)
  80. @State componentStates: number[] = []
  81. // 工序组件对应的图标
  82. componentResMap: Map<string, Resource> = new Map([
  83. ['1', $r('app.media.process_component_material_collect')],
  84. ['2', $r('app.media.process_component_record_item')],
  85. ['3', $r('app.media.process_component_multi_media_collect')],
  86. ['4', $r('app.media.process_component_esop')],
  87. ['5', $r('app.media.process_component_self_inspect')],
  88. ['6', $r('app.media.process_component_device_record')],
  89. ['7', $r('app.media.process_component_fastening')],
  90. ['9', $r('app.media.process_component_label_bind')],
  91. ['10', $r('app.media.process_component_self_inspect')],
  92. ])
  93. // 扫码开工后的生产过程信息
  94. @State process: ProcessInfo = {}
  95. // 扫码开工状态(0:未开工 1:已开工)
  96. @State scanState: number = 0
  97. // 工单下流转卡号列表
  98. @State seqList: WorkOrderSeq[] = []
  99. // 设备每日点检
  100. @State deviceChecks: ProcessDeviceDailyCheck[] = []
  101. private scrollerList: Scroller = new Scroller()
  102. @Provide('currentDept') currentDept:string = ''
  103. @Provide('currentProductLine') currentProductLine:string = ''
  104. @Provide('currentStation') currentStation:string = ''
  105. @Provide('stationIp') stationIp:string = ''
  106. @Provide('currentPLCode') currentPLCode:string = ''
  107. @Provide('currentOrgId') currentOrgId:number = 0
  108. @Provide('currentStationId') @Watch('refreshWorkOrder') currentStationId: string = ''
  109. @Provide('currentUserName') currentUserName: string =''
  110. @Provide('currentUserId') currentUserId: number = 0
  111. @Provide('bindTaskSeq') bindTaskSeq: BindTaskSeqVO[] = []
  112. @State reportList: ReportInfo[] = []
  113. @State currentReporterIndex:number =0
  114. @State currentReportNumIndex:number =0
  115. @State currentUnqualifiedIndex:number =0
  116. // mqtt是否连接
  117. @State isConnected: boolean = false
  118. // 工位发生改变则可能需要重新选择工单
  119. async refreshWorkOrder() {
  120. if (!this.selectWorkOder || !this.selectWorkOder.workOrderCode) {
  121. return
  122. }
  123. console.log('hhtest', '执行刷新------' +this.currentStationId)
  124. let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage2', {
  125. stationId: this.currentStationId,
  126. queryComplete: 0,
  127. } as RequestParamModel) as WorkOrderPage;
  128. this.workOrders = queryRes?.records??[]
  129. if (this.workOrders) {
  130. let clearFlag: boolean = true
  131. for (const element of this.workOrders) {
  132. console.log('hhtest', '工单编码-----------------' + element.workOrderCode)
  133. if (element.workOrderCode! === this.selectWorkOder.workOrderCode) {
  134. clearFlag = false
  135. break
  136. }
  137. }
  138. if (clearFlag) {
  139. this.selectWorkOder = {}
  140. this.clearSelectData()
  141. this.selectOrderController.open()
  142. console.log('hhtest', '选择工单被清空-----------------')
  143. }
  144. } else {
  145. this.selectWorkOder = {}
  146. this.clearSelectData()
  147. this.selectOrderController.open()
  148. console.log('hhtest', '选择工单被清空-----------------')
  149. }
  150. }
  151. // 扫码开工
  152. async scanCodeToStartWork() {
  153. this.process = await ProcessRequest.post('/api/v1/process/info/scan', {
  154. operationId: this.selectOperationId,
  155. qrCode: this.scanCode,
  156. workOrderCode: this.selectWorkOder.workOrderCode!,
  157. stationId: this.currentStationId
  158. } as RequestParamModel)
  159. this.opComponents = []
  160. if (this.process && this.process.id) {
  161. this.opComponents = await ProcessRequest.get(`/api/v1/process/opCompent/get/${this.selectOperationId!}/${this.process?.id!}`)
  162. if (this.opComponents) {
  163. for (const element of this.opComponents) {
  164. if (CommonConstants.OPERATION_COMPONENT_TYPE.has(element.compentType!)) {
  165. element.compentType = CommonConstants.OPERATION_COMPONENT_TYPE.get(element.compentType!)
  166. }
  167. }
  168. }
  169. // 过滤掉点检工步
  170. this.opComponents = this.opComponents.filter(item => item.compentType !== '5');
  171. this.opComponents.unshift({
  172. compentName:'自检',
  173. compentType: '5',
  174. deleted:0,
  175. operationId: this.selectOperationId,
  176. processRouteId: this.process?.id,
  177. remark:'',
  178. sortNum:0
  179. })
  180. }
  181. this.scanState = 1
  182. // 保存此流转卡号到数据库中
  183. let seqNos: string[] = []
  184. seqNos = await preferencesUtil.get(CommonConstants.PREFERENCE_INSTANCE_NAME, this.selectWorkOder.workOrderCode!, seqNos)
  185. if (seqNos.includes(this.seqNo)) {
  186. return
  187. }
  188. seqNos.push(this.seqNo)
  189. preferencesUtil.put(CommonConstants.PREFERENCE_INSTANCE_NAME, this.selectWorkOder.workOrderCode!, seqNos)
  190. }
  191. // 未开工查询工序组件(工步)
  192. async getComponentsForNotStartWork() {
  193. this.opComponents = await ProcessRequest.get('/api/v1/op/compent/get/' + this.selectOperationId)
  194. if (this.opComponents) {
  195. for (const element of this.opComponents) {
  196. if (CommonConstants.OPERATION_COMPONENT_TYPE.has(element.compentType!)) {
  197. element.compentType = CommonConstants.OPERATION_COMPONENT_TYPE.get(element.compentType!)
  198. }
  199. }
  200. }
  201. // 过滤掉点检工步
  202. this.opComponents = this.opComponents.filter(item => item.compentType !== '5');
  203. this.opComponents.unshift({
  204. compentName: '自检',
  205. compentType: '5',
  206. deleted: 0,
  207. operationId: this.selectOperationId,
  208. processRouteId: '0',
  209. remark: '',
  210. sortNum: 0
  211. })
  212. }
  213. // 清除选中的相关数据(工单不做处理)
  214. clearSelectData() {
  215. this.selectOperationId = ''
  216. this.seqNo = ''
  217. this.seqList = []
  218. this.scanState = 0
  219. this.process = {}
  220. this.opComponents = []
  221. this.taskSeqArray = []
  222. this.handleAllClick()
  223. }
  224. handleAllClick():void {
  225. this.onQueryTask([])
  226. }
  227. handleReportedClick():void{
  228. this.onQueryTask([2])
  229. }
  230. handleUnreportedClick():void{
  231. this.onQueryTask([-1,0,1])
  232. }
  233. onQueryTask = async (currentStateList: Array<number>)=>{
  234. if (!this.selectWorkOder.workOrderCode || !this.currentStationId || !this.selectOperationId) {
  235. return
  236. }
  237. this.taskSeqArray = await ProcessRequest.post('/api/v1/plan/task/list', {
  238. stationId: this.currentStationId,
  239. workOrderCode: this.selectWorkOder.workOrderCode!,
  240. operationId: this.selectOperationId,
  241. stateList: currentStateList
  242. } as RequestParamModel) as TaskSeqVO[];
  243. }
  244. connectMQTT = async ()=> {
  245. const clientOptions: MqttClientOptions = {
  246. url: 'mqtt://192.168.1.3:1883', // 替换实际IP
  247. clientId: `process_client_${Date.now()}`,
  248. persistenceType: 1, // 使用英文逗号 // 建议开启自动重连
  249. };
  250. // MQTT连接配置
  251. const connectOptions: MqttConnectOptions = {
  252. cleanSession: true,
  253. connectTimeout: 30,
  254. keepAliveInterval: 60,
  255. userName: 'optional_username',
  256. password: 'optional_password'
  257. };
  258. try {
  259. MqttManager.init(clientOptions);
  260. this.isConnected = await MqttManager.connect(connectOptions);
  261. if (this.isConnected ) {
  262. console.info('hhtest', 'MQTT connected successfully');
  263. await MqttManager.subscribe(CommonConstants.mqttSubscribeTopic1);
  264. await MqttManager.subscribe(CommonConstants.mqttSubscribeTopic3);
  265. if (CommonConstants.mqttSubscribeTopic1 != CommonConstants.mqttSubscribeTopic2) {
  266. await MqttManager.subscribe(CommonConstants.mqttSubscribeTopic2);
  267. }
  268. } else {
  269. console.error('hhtest', 'MQTT connection failed');
  270. }
  271. } catch (err) {
  272. console.error('hhtest', `MQTT error: ${JSON.stringify(err)}`);
  273. }
  274. }
  275. connectUsbDevice=async()=>{
  276. return USBDeviceManager.getInstance();
  277. }
  278. onPageShow() {
  279. const params = router.getParams() as Params; // 获取传递过来的参数对象
  280. if (params && params.auxiliaryOperationFlag) {
  281. this.isAuxiliaryViewOpen = true
  282. }
  283. }
  284. async aboutToAppear() {
  285. // 获取工位ip
  286. this.stationIp = CommonConstants.STATION_DEFAULT_IP
  287. try {
  288. const netHandle = connection.getDefaultNetSync();
  289. if (netHandle) {
  290. let connectionProperties = await connection.getConnectionProperties(netHandle)
  291. if (connectionProperties && connectionProperties.linkAddresses) {
  292. connectionProperties.linkAddresses.forEach((address: connection.LinkAddress, index: number) => {
  293. this.stationIp = address.address.address
  294. if (address.address.address.startsWith(CommonConstants.ipPrefix)) {
  295. // todo 部署时放开注释
  296. // CommonConstants.mqttSubscribeTopic1 = 'station' + address.address.address.replace(CommonConstants.ipPrefix, '') + '/data/devices'
  297. // CommonConstants.mqttSubscribePublish = 'station' + address.address.address.replace(CommonConstants.ipPrefix, '') + '/cmd/devices'
  298. }
  299. })
  300. }
  301. }
  302. } catch (err) {
  303. console.log('hhtest', err);
  304. }
  305. // 创建mqtt连接和usb设备连接
  306. this.connectMQTT()
  307. this.connectUsbDevice()
  308. // 判断是否选中工单,未选择则选则工单
  309. if (!this.selectWorkOder || !this.selectWorkOder.workOrderCode) {
  310. this.selectOrderController.open()
  311. }
  312. //判断今日是否进行设备点检,否则先进行点检
  313. this.deviceChecks = await ProcessRequest.post('/api/v1/process/deviceDailyCheck/list', {
  314. stationIp: this.stationIp,
  315. createDate: TimeUtil.getCurrentDate()
  316. } as RequestParamModel)
  317. if (!this.deviceChecks || this.deviceChecks.length <= 0) {
  318. this.deviceInspectionController.open()
  319. }
  320. // todo 删除
  321. let token:string = await ProcessRequest.post('api/auth/aioLogin', {
  322. password: '123456',
  323. userName: 'admin',
  324. } as RequestParamModel) ;
  325. if (token && token.length > 0) {
  326. CommonConstants.AUTH_TOKEN = token
  327. this.currentUserName = 'admin'
  328. }
  329. this.currentProductLine = '配件产线01'
  330. this.currentPLCode = 'PL000018'
  331. this.currentStationId = '66'
  332. this.currentStation = '装配工位'
  333. let res:UserInfo = await ProcessRequest.get('/api/auth') ;
  334. this.currentUserId = res.id!
  335. // ---------------删除以上内容------------------
  336. }
  337. build() {
  338. Stack() {
  339. Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
  340. //时间和导航标
  341. Row() {
  342. TimeAndTitle()
  343. }.width('100%')
  344. .height('3.4%')
  345. .alignItems(VerticalAlign.Bottom)
  346. .justifyContent(FlexAlign.End)
  347. Row() {
  348. Image($r('app.media.general_return'))
  349. .height($r('app.float.virtualSize_56'))
  350. .width($r('app.float.virtualSize_56'))
  351. .fillColor($r('app.color.FFFFFF'))
  352. Text('生产执行')
  353. .fontColor($r('app.color.FFFFFF'))
  354. .fontSize($r('app.float.fontSize_30'))
  355. .fontWeight(FontWeight.Medium)
  356. }
  357. .height('4%')
  358. .width('94.8%')
  359. .justifyContent(FlexAlign.Start)
  360. .onClick(() => {
  361. // router.back()
  362. window.getLastWindow(getContext()).then((data) => {
  363. //获取窗口对象
  364. let windowClass = data;
  365. windowClass.minimize((err: BusinessError) => {
  366. const errCode: number = err.code;
  367. if (errCode) {
  368. console.error('Failed to minimize the window. Cause: ' + JSON.stringify(err));
  369. return;
  370. }
  371. console.info('Succeeded in minimizing the window.');
  372. });
  373. console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
  374. });
  375. return true;
  376. })
  377. Row().height('2.8%')
  378. // 主要操作栏
  379. Row() {
  380. // 左侧选择工单、工位、人员;工序查看
  381. Column() {
  382. if (this.selectWorkOder && this.selectWorkOder.workOrderCode) {
  383. Column() {
  384. Text(this.selectWorkOder.materialName!)
  385. .fontWeight(FontWeight.Medium)
  386. .fontColor($r('app.color.FFFFFF'))
  387. .fontSize($r('app.float.fontSize_24'))
  388. .width('88.9%')
  389. Text(this.selectWorkOder.materialCode!)
  390. .fontWeight(FontWeight.Lighter)
  391. .fontColor($r('app.color.FFFFFF'))
  392. .fontSize($r('app.float.fontSize_12'))
  393. .width('88.9%')
  394. Row() {
  395. Text('工单:')
  396. .fontWeight(FontWeight.Lighter)
  397. .fontColor($r('app.color.FFFFFF'))
  398. .fontSize($r('app.float.fontSize_12'))
  399. Text(this.selectWorkOder.workOrderCode!)
  400. .fontWeight(FontWeight.Bold)
  401. .fontColor($r('app.color.FFFFFF'))
  402. .fontSize($r('app.float.fontSize_16'))
  403. }
  404. .width('88.9%')
  405. }
  406. .width('100%')
  407. .height('12.4%')
  408. .justifyContent(FlexAlign.Center)
  409. .backgroundColor($r('app.color.20FFFFFF'))
  410. .borderRadius($r('app.float.fontSize_16'))
  411. .onClick(() => {
  412. this.selectOrderController.open()
  413. })
  414. } else {
  415. Button('请选择工单', { type: ButtonType.Normal })
  416. .width('100%')
  417. .height('12.4%')
  418. .fontWeight(FontWeight.Medium)
  419. .fontColor($r('app.color.FFFFFF'))
  420. .fontSize($r('app.float.fontSize_24'))
  421. .backgroundColor($r('app.color.20FFFFFF'))
  422. .borderRadius($r('app.float.fontSize_16'))
  423. .onClick(() => {
  424. this.selectOrderController.open()
  425. })
  426. }
  427. // 登录信息(工位、人员信息)
  428. Row() {
  429. Row().width('5.6%')
  430. Column() {
  431. Text(this.currentStation)
  432. .fontSize($r('app.float.fontSize_16'))
  433. .fontWeight(FontWeight.Regular)
  434. .fontColor($r('app.color.FFFFFF'))
  435. Text(this.currentUserName)
  436. .fontSize($r('app.float.fontSize_12'))
  437. .fontWeight(FontWeight.Lighter)
  438. .fontColor($r('app.color.FFFFFF'))
  439. }
  440. .width('48.8%')
  441. .height('100%')
  442. .justifyContent(FlexAlign.Center)
  443. .alignItems(HorizontalAlign.Start)
  444. Row() {
  445. Text(this.noticeNum > 99 ? '99+' : this.noticeNum.toString())
  446. .fontSize($r('app.float.fontSize_16'))
  447. .fontWeight(FontWeight.Bold)
  448. .fontColor($r('app.color.FFFFFF'))
  449. .textAlign(TextAlign.Center)
  450. .height('42.3%')
  451. .width('42%')
  452. .backgroundColor($r('app.color.20FFFFFF'))
  453. .borderRadius($r('app.float.fontSize_16'))
  454. }
  455. .width('40%')
  456. .height('100%')
  457. .justifyContent(FlexAlign.End)
  458. Row().width('5.6%')
  459. }
  460. .width('100%')
  461. .height('8.1%')
  462. .backgroundColor($r('app.color.20FFFFFF'))
  463. .borderRadius($r('app.float.fontSize_16'))
  464. .onClick(() => {
  465. this.loginInfoController.open()
  466. })
  467. // 工序
  468. Column({ space: 4 }) {
  469. Row() {
  470. Text('工序')
  471. .fontWeight(FontWeight.Medium)
  472. .fontColor($r('app.color.FFFFFF'))
  473. .fontSize($r('app.float.fontSize_24'))
  474. }
  475. .width('83.4%')
  476. .height('8.4%')
  477. .alignItems(VerticalAlign.Bottom)
  478. List() {
  479. ForEach(this.selectWorkOder.ops!, (item: OperationInfo, index: number) => {
  480. ListItem() {
  481. Column() {
  482. Row() {
  483. Row() {
  484. Text((index + 1).toString())
  485. .fontSize($r('app.float.fontSize_16'))
  486. .fontColor(this.selectOperationId === item.operationId ? $r('app.color.90000000') : $r('app.color.FFFFFF'))
  487. .fontWeight(FontWeight.Bold)
  488. }
  489. .width('14.6%')
  490. .height('80%')
  491. .justifyContent(FlexAlign.Center)
  492. Row() {
  493. Text(item.operationName)
  494. .fontSize($r('app.float.fontSize_16'))
  495. .fontColor(this.selectOperationId === item.operationId ? $r('app.color.90000000') : $r('app.color.FFFFFF'))
  496. .fontWeight(FontWeight.Regular)
  497. .padding({ left: 5 })
  498. }
  499. .width('70.8%')
  500. .height('100%')
  501. .alignItems(VerticalAlign.Center)
  502. .justifyContent(FlexAlign.Start)
  503. Row() {
  504. Image(this.selectOperationId === item.operationId ? $r('app.media.process_current_operation') : (item.isEnd! ? $r('app.media.process_complete') : ''))
  505. .width($r('app.float.virtualSize_24'))
  506. .height($r('app.float.virtualSize_24'))
  507. .fillColor(this.selectOperationId === item.operationId ? $r('app.color.90000000') : $r('app.color.FFFFFF'))
  508. .opacity(this.selectOperationId != item.operationId && !item.isEnd ? 0 : 1)
  509. }
  510. .width('14.6%')
  511. .height('100%')
  512. .justifyContent(FlexAlign.Center)
  513. }
  514. .width('100%')
  515. .height('70%')
  516. .borderRadius($r('app.float.virtualSize_40'))
  517. .backgroundImage(this.selectOperationId === item.operationId ? $r('app.media.process_select_operation') : $r('app.media.process_no_select_operation'))
  518. .backgroundImageSize(ImageSize.Cover)
  519. .onClick(() => {
  520. if (!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId) {
  521. return
  522. }
  523. this.selectOperationId = item.operationId!
  524. this.selectOperationName = item.operationName!
  525. if (!item.exists) {
  526. promptAction.showToast({
  527. message: `${item.operationName}需要在${item.stationName}工位上生产`,
  528. duration: 1500,
  529. bottom: 100
  530. })
  531. if (this.scanCode) {
  532. // 未开工查询工序组件
  533. this.getComponentsForNotStartWork()
  534. }
  535. } else if (this.scanState === 0 && this.scanCode) {
  536. // 未开工查询工序组件
  537. this.getComponentsForNotStartWork()
  538. } else if (this.scanState === 1) {
  539. this.scanCodeToStartWork()
  540. }
  541. if (!this.seqNo || this.seqNo.length <= 0) {
  542. this.handleAllClick()
  543. }
  544. })
  545. if (index < (this.selectWorkOder?.ops && this.selectWorkOder?.ops?.length ? this.selectWorkOder?.ops!.length : 0) - 1) {
  546. Row() {
  547. Divider()
  548. .vertical(true)
  549. .color($r('app.color.60FFFFFF'))
  550. .padding({ right: '15%' })
  551. }
  552. .justifyContent(FlexAlign.Center)
  553. .width('20%')
  554. .layoutWeight(1)
  555. }
  556. }
  557. .width('100%')
  558. .height('10.6%')
  559. .alignItems(HorizontalAlign.Start)
  560. }
  561. })
  562. }
  563. .width('83.4%')
  564. .height('88.6%')
  565. .alignListItem(ListItemAlign.Center)
  566. }
  567. .width('100%')
  568. .height('77.2%')
  569. .backgroundColor($r('app.color.20FFFFFF'))
  570. .borderRadius($r('app.float.fontSize_16'))
  571. .opacity(!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId ? 0.3 : 1)
  572. }
  573. .height('100%')
  574. .width('19.8%')
  575. .justifyContent(FlexAlign.SpaceBetween)
  576. // 右侧生产操作栏
  577. if (this.opComponents.length <= 0) {
  578. // 没有工序组件则展示扫码页面
  579. Column() {
  580. Row() {
  581. Text('录入流水号')
  582. .fontSize($r('app.float.fontSize_30'))
  583. .fontWeight(FontWeight.Medium)
  584. .fontColor($r('app.color.FFFFFF'))
  585. }
  586. .height('10%')
  587. .width('97.2%')
  588. .justifyContent(FlexAlign.Start)
  589. Row() {
  590. Column({ space: 8 }) {
  591. Row() {
  592. this.buildButton(0, '全部', () => this.handleAllClick())
  593. this.buildButton(1, '已报工', () => this.handleReportedClick())
  594. this.buildButton(2, '未报工', () => this.handleUnreportedClick())
  595. }
  596. .width('72%')
  597. .height('5.3%')
  598. .justifyContent(FlexAlign.Start)
  599. List({ space: 4, scroller: this.scrollerList }) {
  600. ForEach(this.taskSeqArray, (item: TaskSeqVO) => {
  601. ListItem() {
  602. taskSeqItem({
  603. item: item,
  604. scanSeqValue: this.scanCode,
  605. selectedButtonIndex: this.selectedButtonIndex
  606. })
  607. }
  608. })
  609. }
  610. .width('72%')
  611. .height('94.7%')
  612. }
  613. .width('52.9%')
  614. .height('100%')
  615. .alignItems(HorizontalAlign.End)
  616. .padding({ right: '2.6%' })
  617. Divider()
  618. .vertical(true)
  619. .color($r('app.color.15FFFFFF'))
  620. .height('100%')
  621. Column({ space: 5 }) {
  622. Row().height('37%')
  623. Row() {
  624. Text('扫描流水/序列/铭牌号')
  625. .fontSize($r('app.float.fontSize_16'))
  626. .fontWeight(FontWeight.Regular)
  627. .fontColor($r('app.color.FFFFFF'))
  628. }
  629. .width('62%')
  630. Row() {
  631. Row().width('3.4%')
  632. // 左侧二维码图标
  633. Image($r('app.media.material_qr_code'))// 请替换为您的二维码图片资源
  634. .width($r('app.float.virtualSize_24'))
  635. .height($r('app.float.virtualSize_24'))
  636. .fillColor($r('app.color.FFFFFF'))
  637. // 扫码输入框
  638. TextInput({ placeholder: '请扫描物料编码', text: this.scanCode })
  639. .type(InputType.Normal)
  640. .placeholderFont({ size: $r('app.float.fontSize_16') })
  641. .placeholderColor($r('app.color.30FFFFFF'))
  642. .fontSize($r('app.float.fontSize_16'))
  643. .fontColor($r('app.color.FFFFFF'))
  644. .enableKeyboardOnFocus(false)
  645. .onChange((value: string) => {
  646. if (!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId) {
  647. return
  648. }
  649. this.scanCode = value
  650. })
  651. .onSubmit(async () => {
  652. if (!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId) {
  653. return
  654. }
  655. // 查询工序组件
  656. this.getComponentsForNotStartWork()
  657. this.seqNo = this.scanCode
  658. // 保存此流转卡号到数据库中
  659. let seqNos: string[] = []
  660. seqNos = await preferencesUtil.get(CommonConstants.PREFERENCE_INSTANCE_NAME, this.selectWorkOder.workOrderCode, seqNos)
  661. if (seqNos.includes(this.seqNo)) {
  662. return
  663. }
  664. seqNos.push(this.seqNo)
  665. preferencesUtil.put(CommonConstants.PREFERENCE_INSTANCE_NAME, this.selectWorkOder.workOrderCode, seqNos)
  666. })
  667. }
  668. .width('65%')
  669. .height('6.5%')
  670. .borderRadius($r('app.float.virtualSize_16'))
  671. .backgroundColor($r('app.color.000000'))
  672. .justifyContent(FlexAlign.Start)
  673. }
  674. .width('52.9%')
  675. .height('100%')
  676. }
  677. .width('100%')
  678. .height('87.7%')
  679. .justifyContent(FlexAlign.Center)
  680. }
  681. .width('79.1%')
  682. .height('100%')
  683. .justifyContent(FlexAlign.Center)
  684. .backgroundColor($r('app.color.20FFFFFF'))
  685. .borderRadius($r('app.float.fontSize_16'))
  686. .opacity(!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId ? 0.3 : 1)
  687. } else {
  688. Column() {
  689. List({ space: 4 }) {
  690. ForEach(this.opComponents, (item: OperationComponent, index: number) => {
  691. ListItem() {
  692. Column() {
  693. Stack() {
  694. Image(this.selectComponentType === item.compentType! ? $r('app.media.process_component_state_select') : (this.componentStates.length >= (index + 1) && this.componentStates[index] === 1 ? $r('app.media.process_component_state_finish') : $r('app.media.process_component_state_no_select')))
  695. .height(this.selectComponentType === item.compentType! ? '100%' : '90%')
  696. .width('100%')
  697. .objectFit(ImageFit.Fill)
  698. .borderRadius($r('app.float.fontSize_16'))
  699. Column({ space: 2 }) {
  700. Image(this.componentResMap.get(item.compentType!))
  701. .height($r('app.float.virtualSize_24'))
  702. .width($r('app.float.virtualSize_24'))
  703. .fillColor(this.selectComponentType === item.compentType! ? $r('app.color.99000000') : (this.componentStates.length >= (index + 1) && this.componentStates[index] === 1 ? $r('app.color.30D158') : $r('app.color.FFFFFF')))
  704. Text(item.compentName!)
  705. .fontSize($r('app.float.fontSize_16'))
  706. .fontWeight(FontWeight.Regular)
  707. .fontColor(this.selectComponentType === item.compentType! ? $r('app.color.99000000') : (this.componentStates.length >= (index + 1) && this.componentStates[index] === 1 ? $r('app.color.30D158') : $r('app.color.FFFFFF')))
  708. }
  709. .width('100%')
  710. .height('90%')
  711. .justifyContent(FlexAlign.Center)
  712. }
  713. .width('100%')
  714. .height('100%')
  715. .alignContent(Alignment.Top)
  716. .onClick(() => {
  717. this.selectComponentType = item.compentType!
  718. })
  719. }
  720. .height('100%')
  721. .width('12.5%')
  722. }
  723. })
  724. }
  725. .listDirection(Axis.Horizontal)
  726. .height('9.3%')
  727. .width('79.1%')
  728. // 不同工序组件(工步)展示不同页面
  729. Column() {
  730. if (this.selectComponentType === '1') {
  731. MaterialCollectView({
  732. scanState: this.scanState,
  733. seqNo: this.seqNo,
  734. selectWorkOder: this.selectWorkOder,
  735. selectOperationId: this.selectOperationId,
  736. process: this.process,
  737. })
  738. } else if (this.selectComponentType === '3' && this.scanState == 1) {
  739. MultiMediaCollect({
  740. seqNo: this.seqNo,
  741. selectOperationId: this.selectOperationId,
  742. process: this.process,
  743. })
  744. } else if (this.selectComponentType === '5') {
  745. SelfInspectView({
  746. scanState: this.scanState,
  747. seqNo: this.seqNo,
  748. selectOperationId: this.selectOperationId,
  749. process: this.process,
  750. })
  751. } else if (this.selectComponentType === '6') {
  752. DeviceCheckView({
  753. deviceChecks: this.deviceChecks,
  754. scanState: this.scanState,
  755. seqNo: this.seqNo,
  756. selectOperationId: this.selectOperationId,
  757. process: this.process,
  758. })
  759. }
  760. }
  761. .width('79.1%')
  762. .height('90.7%')
  763. .backgroundColor($r('app.color.20FFFFFF'))
  764. .borderRadius($r('app.float.fontSize_16'))
  765. }
  766. }
  767. }
  768. .height('80%')
  769. .width('94.8%')
  770. .justifyContent(FlexAlign.SpaceBetween)
  771. // 底部按钮和抽屉
  772. Stack() {
  773. Column() {
  774. Blank()
  775. Stack() {
  776. Image($r('app.media.process_drawer_thumbnail'))
  777. .width('100%')
  778. .height('100%')
  779. Image($r('app.media.process_drawer_switch'))
  780. .width($r('app.float.virtualSize_48'))
  781. .height($r('app.float.virtualSize_48'))
  782. .fillColor($r('app.color.60FFFFFF'))
  783. }
  784. .width('100%')
  785. .height('47%')
  786. }
  787. .width('100%')
  788. .height('100%')
  789. Row() {
  790. Row({ space: 4 }) {
  791. Image($r('app.media.process_work_instruction'))
  792. .width($r('app.float.virtualSize_24'))
  793. .height($r('app.float.virtualSize_24'))
  794. .fillColor($r('app.color.0A84FF'))
  795. Text('作业指导')
  796. .fontColor($r('app.color.0A84FF'))
  797. .fontSize($r('app.float.fontSize_24'))
  798. .fontWeight(FontWeight.Medium)
  799. }
  800. .width('10%')
  801. .height('58.3%')
  802. .justifyContent(FlexAlign.Center)
  803. .backgroundColor($r('app.color.20FFFFFF'))
  804. .borderRadius($r('app.float.fontSize_16'))
  805. .onClick(() => {
  806. if (!this.selectWorkOder.workOrderCode) {
  807. return
  808. }
  809. this.workInstructionsController.open()
  810. })
  811. Row().width('1.5%')
  812. Row({ space: 4 }) {
  813. Image($r('app.media.process_complete_reception'))
  814. .width($r('app.float.virtualSize_24'))
  815. .height($r('app.float.virtualSize_24'))
  816. .fillColor($r('app.color.0A84FF'))
  817. Text('齐套接收')
  818. .fontColor($r('app.color.0A84FF'))
  819. .fontSize($r('app.float.fontSize_24'))
  820. .fontWeight(FontWeight.Medium)
  821. }
  822. .width('10%')
  823. .height('58.3%')
  824. .justifyContent(FlexAlign.Center)
  825. .backgroundColor($r('app.color.20FFFFFF'))
  826. .borderRadius($r('app.float.fontSize_16'))
  827. .onClick(() => {
  828. if (!this.selectWorkOder.workOrderCode) {
  829. return
  830. }
  831. this.completeReceiveController.open()
  832. })
  833. Blank()
  834. .onClick(() => {
  835. this.isAuxiliaryViewOpen = true
  836. })
  837. Column({ space: 2 }) {
  838. Row() {
  839. Text((this.selectWorkOder && this.selectWorkOder.workOrderCode) ? parseInt(this.selectWorkOder.completeNum!) + '/' + parseInt(this.selectWorkOder.planNum) : '')
  840. .fontColor($r('app.color.FFFFFF'))
  841. .fontSize($r('app.float.fontSize_16'))
  842. .fontWeight(FontWeight.Lighter)
  843. }
  844. .width('100%')
  845. .height('50%')
  846. .justifyContent(FlexAlign.End)
  847. .alignItems(VerticalAlign.Bottom)
  848. Row() {
  849. if (this.seqNo.length > 0) {
  850. Text('S/N ')
  851. .fontColor($r('app.color.FFFFFF'))
  852. .fontSize($r('app.float.fontSize_16'))
  853. .fontWeight(FontWeight.Lighter)
  854. Text(this.seqNo)
  855. .fontColor($r('app.color.FFFFFF'))
  856. .fontSize($r('app.float.fontSize_16'))
  857. .fontWeight(FontWeight.Bold)
  858. }
  859. }
  860. .width('100%')
  861. .height('50%')
  862. .justifyContent(FlexAlign.End)
  863. .alignItems(VerticalAlign.Top)
  864. }
  865. .width('10.8%')
  866. .height('100%')
  867. Row().width('1%')
  868. Row({ space: 4 }) {
  869. Image($r('app.media.process_switch'))
  870. .width($r('app.float.virtualSize_24'))
  871. .height($r('app.float.virtualSize_24'))
  872. .fillColor($r('app.color.0A84FF'))
  873. Text('切换产品')
  874. .fontColor($r('app.color.0A84FF'))
  875. .fontSize($r('app.float.fontSize_24'))
  876. .fontWeight(FontWeight.Medium)
  877. }
  878. .width('10%')
  879. .height('58.3%')
  880. .justifyContent(FlexAlign.Center)
  881. .backgroundColor($r('app.color.20FFFFFF'))
  882. .borderRadius($r('app.float.fontSize_16'))
  883. .onClick(() => {
  884. if (!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId || !this.selectOperationId) {
  885. return
  886. }
  887. this.switchingProductDialogController.open()
  888. })
  889. Row().width('1.5%')
  890. Row({ space: 4 }) {
  891. Image(this.scanState === 1 ? $r('app.media.process_report') : $r('app.media.process_start_work'))
  892. .width($r('app.float.virtualSize_24'))
  893. .height($r('app.float.virtualSize_24'))
  894. .fillColor($r('app.color.FFFFFF'))
  895. Text(this.scanState === 1 ? '工序报工' : '工序开工')
  896. .fontColor($r('app.color.FFFFFF'))
  897. .fontSize($r('app.float.fontSize_24'))
  898. .fontWeight(FontWeight.Medium)
  899. }
  900. .width('10%')
  901. .height('58.3%')
  902. .justifyContent(FlexAlign.Center)
  903. .backgroundColor(this.scanState === 1 ? $r('app.color.30D158') : $r('app.color.0A84FF'))
  904. .borderRadius($r('app.float.fontSize_16'))
  905. .onClick(async () => {
  906. if (!this.scanCode || this.scanCode.length <= 0) {
  907. promptAction.showToast({
  908. message: `请先扫描流水/序列/铭牌号`,
  909. duration: 1500,
  910. bottom: 100
  911. })
  912. return
  913. }
  914. if (!this.selectOperationId || this.selectOperationId.length <= 0) {
  915. promptAction.showToast({
  916. message: `请先选择工序`,
  917. duration: 1500,
  918. bottom: 100
  919. })
  920. return
  921. }
  922. if (this.scanState === 0) {
  923. this.scanCodeToStartWork()
  924. } else if (this.scanState === 1) {
  925. this.processReportingController.open()
  926. }
  927. })
  928. }
  929. .height('90.6%')
  930. .width('100%')
  931. .padding({ left: '2.6%', right: '2.6%' })
  932. .opacity(!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId ? 0.3 : 1)
  933. }
  934. .width('100%')
  935. .height('9.8%')
  936. .alignContent(Alignment.Top)
  937. }
  938. .width('100%')
  939. .height('100%')
  940. .backgroundColor($r('app.color.000000'))
  941. if (this.isAuxiliaryViewOpen) {
  942. Column() {
  943. AuxiliaryOperationView({
  944. workOrderCode: this.selectWorkOder?.workOrderCode!,
  945. seqList: this.seqList,
  946. isAuxiliaryViewOpen:this.isAuxiliaryViewOpen,
  947. process: this.process,
  948. openLittleMaterialRequestDialog: ()=>{
  949. this.littleMaterialRequestController.open()
  950. },
  951. openBarcodeAssociationDialog: ()=>{
  952. this.barcodeAssociationController.open()
  953. },
  954. openInAndOutBoundDialog: ()=>{
  955. this.inAndOutBoundController.open()
  956. },
  957. openPictureDrawingDialog: ()=>{
  958. this.pictureDrawingController.open()
  959. },
  960. openDeviceInspectionDialog: ()=>{
  961. this.deviceInspectionController.open()
  962. },
  963. })
  964. .height('93.5%')
  965. .width('100%')
  966. }
  967. .height('100%')
  968. .width('100%')
  969. .justifyContent(FlexAlign.End)
  970. .transition(
  971. TransitionEffect.OPACITY
  972. .combine(TransitionEffect.translate({ y: 1000 }))
  973. .animation({
  974. duration:1500,
  975. curve: Curve.EaseOut
  976. })
  977. )
  978. .opacity(this.isAuxiliaryViewOpen ? 1 : 0)
  979. .translate({ y: this.isAuxiliaryViewOpen ? 0 : 1000 })
  980. }
  981. }
  982. .height('100%')
  983. .width('100%')
  984. }
  985. @Builder
  986. buildButton(index: number, text: string, onClick: () => void) {
  987. Row({space: 5}){
  988. if(this.selectedButtonIndex === index) {
  989. Image($r('app.media.process_radio_check'))
  990. .width($r('app.float.virtualSize_24'))
  991. .height($r('app.float.virtualSize_24'))
  992. .fillColor($r('app.color.0A84FF'))
  993. } else {
  994. Image($r('app.media.process_radio_no_check'))
  995. .width($r('app.float.virtualSize_24'))
  996. .height($r('app.float.virtualSize_24'))
  997. .fillColor($r('app.color.FFFFFF'))
  998. }
  999. Text(text)
  1000. .fontSize($r('app.float.fontSize_16'))
  1001. .fontColor($r('app.color.FFFFFF'))
  1002. }
  1003. .justifyContent(FlexAlign.Center)
  1004. .width('24.3%')
  1005. .height('100%')
  1006. .backgroundColor(this.selectedButtonIndex === index ? $r('app.color.200A84FF') : $r('app.color.20FFFFFF')) // 选中蓝/未选中灰
  1007. .borderRadius($r('app.float.virtualSize_16'))
  1008. .margin({ right:'3%'})
  1009. .onClick(() => {
  1010. this.selectedButtonIndex = index
  1011. onClick();
  1012. })
  1013. }
  1014. // 选择工单弹窗控制器
  1015. selectOrderController: CustomDialogController = new CustomDialogController({
  1016. builder: SelectWorkOrderDialog({
  1017. selectWorkOder: this.selectWorkOder,
  1018. onConfirm: ()=>{
  1019. this.clearSelectData()
  1020. }
  1021. }),
  1022. autoCancel: true, // 点击遮罩关闭
  1023. customStyle: true,
  1024. alignment:DialogAlignment.Center,
  1025. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1026. })
  1027. // 选择工位和用户弹窗控制器
  1028. loginInfoController: CustomDialogController = new CustomDialogController({
  1029. builder: LoginInfoDialog({
  1030. searchDept:()=>{this.SwitchingDeptController.open()},
  1031. searchStation:()=>{this.SwitchingStationController.open()},
  1032. searchProductLine:()=>{this.SwitchingProductLineController.open()},
  1033. }),
  1034. autoCancel: true, // 点击遮罩关闭
  1035. customStyle: true,
  1036. alignment:DialogAlignment.Center,
  1037. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1038. })
  1039. //切换部门弹窗控制器
  1040. SwitchingDeptController: CustomDialogController = new CustomDialogController({
  1041. builder: SwitchingDeptDialog({}),
  1042. autoCancel: true, // 点击遮罩关闭
  1043. customStyle: true,
  1044. alignment:DialogAlignment.Center,
  1045. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1046. })
  1047. // 工序报工-报工数量弹窗
  1048. ReportWorkNumController: CustomDialogController = new CustomDialogController({
  1049. builder: ReportWorkNumDialog({
  1050. userName: this.reportList[this.currentReportNumIndex].userName,
  1051. currentOperationId: this.selectOperationId,
  1052. currentWorkOrderCode: this.selectWorkOder.workOrderCode!,
  1053. onConfirm:(num:number)=>{
  1054. const index = this.currentReportNumIndex;
  1055. if (this.reportList[index]) {
  1056. this.reportList[index].reportNum = String(num);
  1057. this.reportList = [...this.reportList];
  1058. }
  1059. }
  1060. }),
  1061. autoCancel: true,
  1062. customStyle: true,
  1063. alignment:DialogAlignment.Center,
  1064. maskColor: 'rgba(0,0,0,0.8)',
  1065. })
  1066. // 工序报工-不良品报工弹窗
  1067. UnqualifiedReportController: CustomDialogController = new CustomDialogController({
  1068. builder: UnqualifiedReportDialog({
  1069. userName: this.reportList[this.currentUnqualifiedIndex].userName,
  1070. onConfirm:(num:number)=>{
  1071. const index = this.currentUnqualifiedIndex;
  1072. if (this.reportList[index]) {
  1073. this.reportList[index].unqualifiedNum = String(num);
  1074. this.reportList = [...this.reportList];
  1075. }
  1076. }
  1077. }),
  1078. autoCancel: true,
  1079. customStyle: true,
  1080. alignment:DialogAlignment.Center,
  1081. maskColor: 'rgba(0,0,0,0.8)',
  1082. })
  1083. // 工序报工-添加参与人员
  1084. JoinPersonNameController: CustomDialogController = new CustomDialogController({
  1085. builder: JoinPersonNameDialog({
  1086. reportList:this.reportList,
  1087. onConfirm:(name:string)=>{
  1088. const nameExists = this.reportList.some(item =>
  1089. item.userName && name &&
  1090. item.userName.toString().toLowerCase() === name.toString().toLowerCase().trim()
  1091. );
  1092. if (nameExists) {
  1093. promptAction.showToast({
  1094. message: '该用户已添加,请添加其他用户!',
  1095. duration: 2000
  1096. });
  1097. return;
  1098. }
  1099. const index = this.currentReporterIndex;
  1100. if (this.reportList[index]) {
  1101. this.reportList[index].userName = name;
  1102. this.reportList = [...this.reportList];
  1103. }
  1104. }
  1105. }),
  1106. autoCancel: true,
  1107. customStyle: true,
  1108. alignment:DialogAlignment.Center,
  1109. maskColor: 'rgba(0,0,0,0.8)',
  1110. })
  1111. // 工序报工弹窗
  1112. processReportingController: CustomDialogController = new CustomDialogController({
  1113. builder: ProcessReportingDialog({
  1114. onSelectReporter:(index:number)=>{
  1115. this.currentReporterIndex = index;
  1116. this.JoinPersonNameController.open();
  1117. },
  1118. onSelectReportNum:(index:number)=>{
  1119. if (!this.reportList[index]?.userName?.trim()) {
  1120. promptAction.showToast({
  1121. message: '请先添加用户',
  1122. duration: 2000
  1123. });
  1124. return;
  1125. }
  1126. this.currentReportNumIndex = index
  1127. this.ReportWorkNumController.open()
  1128. },
  1129. onSelectUnqualified:(index:number)=>{
  1130. if (!this.reportList[index]?.userName?.trim()) {
  1131. promptAction.showToast({
  1132. message: '请先添加用户',
  1133. duration: 2000
  1134. });
  1135. return;
  1136. }
  1137. this.currentUnqualifiedIndex = index
  1138. this.UnqualifiedReportController.open()
  1139. },
  1140. reportList:this.reportList,
  1141. selectWorkOder: this.selectWorkOder,
  1142. selectOperationName: this.selectOperationName,
  1143. selectOperationId: this.selectOperationId
  1144. }),
  1145. autoCancel: true,
  1146. customStyle: true,
  1147. alignment:DialogAlignment.Center,
  1148. maskColor: 'rgba(0,0,0,0.8)',
  1149. })
  1150. // 切换产线弹窗控制器
  1151. SwitchingProductLineController: CustomDialogController = new CustomDialogController({
  1152. builder: SwitchingProductLineDialog({}),
  1153. autoCancel: true, // 点击遮罩关闭
  1154. customStyle: true,
  1155. alignment:DialogAlignment.Center,
  1156. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1157. })
  1158. // 切换工位弹窗控制器
  1159. SwitchingStationController: CustomDialogController = new CustomDialogController({
  1160. builder: SwitchingStationDialog({}),
  1161. autoCancel: true, // 点击遮罩关闭
  1162. customStyle: true,
  1163. alignment:DialogAlignment.Center,
  1164. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1165. })
  1166. //切换用户弹窗控制器
  1167. switchingUserController: CustomDialogController = new CustomDialogController({
  1168. builder: SwitchingUserDialog({}),
  1169. autoCancel: true, // 点击遮罩关闭
  1170. customStyle: true,
  1171. alignment:DialogAlignment.Center,
  1172. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1173. })
  1174. // 切换产品弹窗控制器
  1175. switchingProductDialogController: CustomDialogController = new CustomDialogController({
  1176. builder: SwitchingProductDialog({
  1177. scanState:this.scanState,
  1178. process:this.process,
  1179. scanSeqValue: this.scanCode,
  1180. selectWorkOder:this.selectWorkOder,
  1181. currentOperationId:this.selectOperationId,
  1182. opComponents:this.opComponents,
  1183. seqNo:this.seqNo,
  1184. }),
  1185. autoCancel: true, // 点击遮罩关闭
  1186. customStyle: true,
  1187. alignment:DialogAlignment.Center,
  1188. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1189. })
  1190. // 作业指导弹窗控制器
  1191. workInstructionsController: CustomDialogController = new CustomDialogController({
  1192. builder: WorkInstructionsDialog({
  1193. materialCode: this.selectWorkOder.materialCode!,
  1194. }),
  1195. autoCancel: true, // 点击遮罩关闭
  1196. customStyle: true,
  1197. alignment:DialogAlignment.Center,
  1198. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1199. })
  1200. // 齐套接收弹窗控制器
  1201. completeReceiveController: CustomDialogController = new CustomDialogController({
  1202. builder: CompleteReceiveDialog({
  1203. currentWorkOrderCode: this.selectWorkOder.workOrderCode!,
  1204. currentOperationId: this.selectOperationId
  1205. }),
  1206. autoCancel: true, // 点击遮罩关闭
  1207. customStyle: true,
  1208. alignment:DialogAlignment.Center,
  1209. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1210. })
  1211. // 零星叫料弹窗控制器
  1212. littleMaterialRequestController: CustomDialogController = new CustomDialogController({
  1213. builder: LittleMaterialRequestDialog({
  1214. }),
  1215. autoCancel: true, // 点击遮罩关闭
  1216. customStyle: true,
  1217. alignment:DialogAlignment.Center,
  1218. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1219. })
  1220. // 仓储操作弹窗控制器
  1221. inAndOutBoundController: CustomDialogController = new CustomDialogController({
  1222. builder: InAndOutBoundDialog({
  1223. }),
  1224. autoCancel: true, // 点击遮罩关闭
  1225. customStyle: true,
  1226. alignment:DialogAlignment.Center,
  1227. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1228. })
  1229. // 条码关联弹窗控制器
  1230. barcodeAssociationController: CustomDialogController = new CustomDialogController({
  1231. builder: BarcodeAssociationDialog({
  1232. workOrderCode: this.selectWorkOder?.workOrderCode!,
  1233. seqList: this.seqList
  1234. }),
  1235. autoCancel: true, // 点击遮罩关闭
  1236. customStyle: true,
  1237. alignment:DialogAlignment.Center,
  1238. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1239. })
  1240. // 图纸资料弹窗控制器
  1241. pictureDrawingController: CustomDialogController = new CustomDialogController({
  1242. builder: PictureDrawingDialog({
  1243. materialCode: this.selectWorkOder?.materialCode!
  1244. }),
  1245. autoCancel: true, // 点击遮罩关闭
  1246. customStyle: true,
  1247. alignment:DialogAlignment.Center,
  1248. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1249. })
  1250. // 设备点检弹窗
  1251. deviceInspectionController: CustomDialogController = new CustomDialogController({
  1252. builder: DeviceInspectionDialog({
  1253. deviceChecks: this.deviceChecks,
  1254. }),
  1255. autoCancel: true, // 点击遮罩关闭
  1256. customStyle: true,
  1257. alignment:DialogAlignment.Center,
  1258. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  1259. })
  1260. }