ProcessIndex.ets 53 KB

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