Index.ets 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. import { TimeAndTitle } from '../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 { SelectOrderDialog } from '../view/SelectOrderDialog';
  9. @Entry
  10. @Component
  11. struct Index {
  12. @State message: string = 'Hello World';
  13. // 工单列表
  14. @State workOrders: WorkOrderInfo[] = []
  15. // 选中工单
  16. @State selectWorkOder: WorkOrderInfo = {
  17. beforeNum: '0.00',
  18. completeNum:'0.00',
  19. inventoryNum:'0.00',
  20. materialCode:'GAS-RTA',
  21. materialModel: 'N2纯度99.9999%,露点<-70°C',
  22. materialName:'快速退火气体',
  23. ops:[
  24. {
  25. exists:false,
  26. firstCheck:0,
  27. inspection:0,
  28. mutualInspection:0,
  29. opComplete:false,
  30. operationCode:'GX-SFZB',
  31. operationId:'679',
  32. operationName:'三防准备',
  33. operationSort:0,
  34. selfCheck:0,
  35. seqs:[],
  36. specialInspection:0,
  37. workOrderCode:'10.25.0022'
  38. },
  39. {
  40. exists:false,
  41. firstCheck:0,
  42. inspection:0,
  43. mutualInspection:0,
  44. opComplete:false,
  45. operationCode:'GX-CXSL',
  46. operationId:'680',
  47. operationName:'程序烧录',
  48. operationSort:1,
  49. selfCheck:0,
  50. seqs:[],
  51. specialInspection:0,
  52. workOrderCode:'10.25.0022'
  53. },
  54. {
  55. exists:true,
  56. firstCheck:0,
  57. inspection:0,
  58. mutualInspection:0,
  59. opComplete:false,
  60. operationCode:'GX-WGJC',
  61. operationId:'681',
  62. operationName:'外观检测',
  63. operationSort:2,
  64. selfCheck:0,
  65. seqs:[
  66. {
  67. currentTask:'当前进度:包装工位1(三防准备)',
  68. seqNo:'10.25.0022-0001',
  69. state:'0'
  70. }
  71. ],
  72. specialInspection:0,
  73. workOrderCode:'10.25.0022'
  74. },
  75. {
  76. exists:false,
  77. firstCheck:0,
  78. inspection:0,
  79. mutualInspection:0,
  80. opComplete:false,
  81. operationCode:'GX-JY',
  82. operationId:'682',
  83. operationName:'检验',
  84. operationSort:3,
  85. selfCheck:0,
  86. seqs:[],
  87. specialInspection:0,
  88. workOrderCode:'10.25.0022'
  89. },
  90. {
  91. exists:false,
  92. firstCheck:0,
  93. inspection:0,
  94. mutualInspection:0,
  95. opComplete:false,
  96. operationCode:'GJ-WWSF',
  97. operationId:'683',
  98. operationName:'委外三防',
  99. operationSort:4,
  100. selfCheck:0,
  101. seqs:[],
  102. specialInspection:0,
  103. workOrderCode:'10.25.0022'
  104. },
  105. {
  106. exists:false,
  107. firstCheck:0,
  108. inspection:0,
  109. mutualInspection:0,
  110. opComplete:false,
  111. operationCode:'GJ-GDWCC',
  112. operationId:'677',
  113. operationName:'高低温存储',
  114. operationSort:5,
  115. selfCheck:0,
  116. seqs:[],
  117. specialInspection:0,
  118. workOrderCode:'10.25.0022'
  119. }
  120. ],
  121. orderCode:'DD2505140001',
  122. orderName:'GAS-RTA',
  123. planNum:'1.00',
  124. planStartEnd:'2025-05-16 08:26:00',
  125. planStartWhen:'2025-05-16 08:00:00',
  126. processRouteCode:'GAS-RTA',
  127. processRouteId:147,
  128. processRouteName:'GAS-RTA',
  129. productLineId:'18',
  130. productLineName:'配件产线01',
  131. workOrderCode:'10.25.0022',
  132. workOrderState:'3',
  133. workshopId:'0',
  134. workshopName:'青半002'
  135. }
  136. // 工位通知数量
  137. @State noticeNum: number = 100
  138. pageNo: number = 1
  139. pageSize: number = 9
  140. SelectOrderController: CustomDialogController = new CustomDialogController({
  141. builder: SelectOrderDialog({}),
  142. autoCancel: true, // 点击遮罩关闭
  143. customStyle: true,
  144. maskColor: 'rgba(0,0,0,0.8)', // 黑色遮罩
  145. })
  146. async aboutToAppear() {
  147. this.SelectOrderController.open()
  148. if (!this.selectWorkOder || !this.selectWorkOder.workOrderCode) {
  149. // this.workOrders = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage', {
  150. // //查询未完成的工单
  151. // queryComplete: 0,
  152. // pageNo: this.pageNo,
  153. // pageSize: this.pageSize
  154. // } as RequestParamModel) as WorkOrderInfo[]
  155. }
  156. }
  157. build() {
  158. Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
  159. //时间和导航标
  160. Row(){
  161. TimeAndTitle()
  162. }.width('100%')
  163. .height('3.4%')
  164. .alignItems(VerticalAlign.Bottom)
  165. .justifyContent(FlexAlign.End)
  166. Row(){
  167. Image($r('app.media.general_return'))
  168. .height($r('app.float.virtualSize_56'))
  169. .width($r('app.float.virtualSize_56'))
  170. .fillColor($r('app.color.FFFFFF'))
  171. Text('生产执行')
  172. .fontColor($r('app.color.FFFFFF'))
  173. .fontSize($r('app.float.fontSize_38'))
  174. }
  175. .height('4%')
  176. .width('94.8%')
  177. .justifyContent(FlexAlign.Start)
  178. .onClick(()=> {
  179. router.back()
  180. })
  181. Row() {
  182. // 左侧选择工单、工位、人员;工序查看
  183. Column() {
  184. Button('请选择工单', { type: ButtonType.Normal })
  185. .width('100%')
  186. .height('12.4%')
  187. .fontWeight(FontWeight.Medium)
  188. .fontColor($r('app.color.FFFFFF'))
  189. .fontSize($r('app.float.fontSize_24'))
  190. .backgroundColor($r('app.color.20FFFFFF'))
  191. .borderRadius($r('app.float.fontSize_16'))
  192. // 工位、人员信息
  193. Row() {
  194. Row().width('5.6%')
  195. Column() {
  196. Text(CommonConstants.STATION_NANE)
  197. .fontSize($r('app.float.fontSize_16'))
  198. .fontWeight(FontWeight.Regular)
  199. .fontColor($r('app.color.FFFFFF'))
  200. Text(CommonConstants.USER_NAME)
  201. .fontSize($r('app.float.fontSize_12'))
  202. .fontWeight(FontWeight.Lighter)
  203. .fontColor($r('app.color.FFFFFF'))
  204. }
  205. .width('48.8%')
  206. .height('100%')
  207. .justifyContent(FlexAlign.Center)
  208. .alignItems(HorizontalAlign.Start)
  209. Row() {
  210. Text(this.noticeNum > 99 ? '99+' : this.noticeNum.toString())
  211. .fontSize($r('app.float.fontSize_16'))
  212. .fontWeight(FontWeight.Bold)
  213. .fontColor($r('app.color.FFFFFF'))
  214. .textAlign(TextAlign.Center)
  215. .height('42.3%')
  216. .width('42%')
  217. .backgroundColor($r('app.color.20FFFFFF'))
  218. .borderRadius($r('app.float.fontSize_16'))
  219. }
  220. .width('40%')
  221. .height('100%')
  222. .justifyContent(FlexAlign.End)
  223. Row().width('5.6%')
  224. }
  225. .width('100%')
  226. .height('8.1%')
  227. .backgroundColor($r('app.color.20FFFFFF'))
  228. .borderRadius($r('app.float.fontSize_16'))
  229. // 工序
  230. Column({space: 4}) {
  231. Row() {
  232. Text('工序')
  233. .fontWeight(FontWeight.Medium)
  234. .fontColor($r('app.color.FFFFFF'))
  235. .fontSize($r('app.float.fontSize_24'))
  236. }
  237. .width('83.4%')
  238. .height('8.4%')
  239. .alignItems(VerticalAlign.Bottom)
  240. List() {
  241. ForEach(this.selectWorkOder.ops!, (item: OperationInfo, index: number) => {
  242. ListItem() {
  243. Column() {
  244. Row({ space: 4 }) {
  245. Stack() {
  246. Circle()
  247. .width('100%')
  248. .height('100%')
  249. .fillOpacity(0)
  250. .stroke($r('app.color.60FFFFFF'))
  251. .strokeWidth('1px')
  252. Row() {
  253. Text((index + 1).toString())
  254. .fontSize($r('app.float.fontSize_16'))
  255. .fontColor($r('app.color.FFFFFF'))
  256. .fontWeight(FontWeight.Bold)
  257. }
  258. .width('100%')
  259. .height('100%')
  260. .alignItems(VerticalAlign.Center)
  261. .justifyContent(FlexAlign.Center)
  262. .margin({right: '15%'})
  263. }
  264. .width('20%')
  265. .height('100%')
  266. Text(item.operationName)
  267. .fontSize($r('app.float.fontSize_16'))
  268. .fontColor( $r('app.color.FFFFFF'))
  269. .fontWeight(FontWeight.Regular)
  270. }
  271. .width('100%')
  272. .height('70%')
  273. .backgroundColor($r('app.color.20FFFFFF'))
  274. .borderRadius($r('app.float.virtualSize_40'))
  275. .justifyContent(FlexAlign.Start)
  276. .padding({ right: '5%' })
  277. .onClick(() => {
  278. })
  279. if (index < this.selectWorkOder.ops!.length - 1) {
  280. Row() {
  281. Divider()
  282. .vertical(true)
  283. .color($r('app.color.60FFFFFF'))
  284. .strokeWidth('1px')
  285. .padding({ right: '15%' })
  286. }
  287. .justifyContent(FlexAlign.Center)
  288. .width('20%')
  289. .layoutWeight(1)
  290. }
  291. }
  292. .width('100%')
  293. .height('10.6%')
  294. .alignItems(HorizontalAlign.Start)
  295. }
  296. })
  297. }
  298. .width('83.4%')
  299. .height('88.6%')
  300. .alignListItem(ListItemAlign.Center)
  301. }
  302. .width('100%')
  303. .height('77.2%')
  304. .backgroundColor($r('app.color.20FFFFFF'))
  305. .borderRadius($r('app.float.fontSize_16'))
  306. }
  307. .height('100%')
  308. .width('19.8%')
  309. .justifyContent(FlexAlign.SpaceBetween)
  310. // 右侧生产操作栏
  311. Column() {
  312. }
  313. .width('79.1%')
  314. .height('100%')
  315. }
  316. .height('80%')
  317. .width('94.8%')
  318. .justifyContent(FlexAlign.SpaceBetween)
  319. }
  320. .width('100%')
  321. .height('100%')
  322. .backgroundColor($r('app.color.000000'))
  323. }
  324. }