ProcessIndex.ets 51 KB

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