ProcessReportingDialog.ets 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. //工序报工
  2. import ProcessRequest from '../common/util/request/ProcessRequest'
  3. import { BindTaskSeqVO } from '../viewmodel/BindTaskSeqVO'
  4. import TaskSeqVO from '../viewmodel/process/TaskSeqInfo'
  5. import ReportInfo from '../viewmodel/ReportInfo'
  6. import RequestParamModel from '../viewmodel/RequestParamModel'
  7. import WorkOrderInfo from '../viewmodel/WorkOrderInfo'
  8. @CustomDialog
  9. export struct ProcessReportingDialog{
  10. private scrollerList: Scroller = new Scroller()
  11. //查询报工
  12. @Link reportList: ReportInfo[]
  13. //当前工单号
  14. @State currentWorkOrderCode:string = ''
  15. //当前工序号
  16. @State currentOperationId:string = ''
  17. //当前工位
  18. @State currentStationId:string = ''
  19. //选择的按钮索引(默认加载全部)
  20. @State addReportingClick: number = 1
  21. //从首页传来的工单
  22. @Prop selectWorkOder: WorkOrderInfo = {}
  23. //工序名字
  24. @Prop selectProcessName:string = '正面三防'
  25. //当前工序已报工数量
  26. @State reportedNum:number = 0
  27. //计划报工数量
  28. @State planReportNum:number = 0
  29. //扫描的流水号/序列/铭牌号
  30. @State scanSeqValue: string = ''
  31. @State userName:string = '王德发'
  32. @State currentReporterIndex: number = 0; // 记录当前点击的报工人索引
  33. @Consume ('bindTaskSeq') bindTaskSeq: BindTaskSeqVO[]
  34. controller: CustomDialogController
  35. onConfirm: () => void = () => {}
  36. //选择报工人
  37. onSelectReporter: (index:number) => void = () => {}
  38. //选择报工数量
  39. onSelectReportNum: (index:number) => void = () => {}
  40. //选择不良品数量
  41. onSelectUnqualified: (index:number) => void = () => {}
  42. updateReporterName(index: number, name: string) {
  43. if (this.reportList[index]) {
  44. this.reportList[index].userName = name;
  45. // 强制刷新界面
  46. this.reportList = [...this.reportList];
  47. }
  48. }
  49. //加载第一个报工人(无法删除)
  50. loadFirstReport=async ()=>{
  51. const firstReporter:ReportInfo= {}
  52. firstReporter.userName = this.userName
  53. this.reportList.push(firstReporter)
  54. }
  55. onQueryTask = async (currentStateList: Array<number>): Promise<number> => {
  56. let res = await ProcessRequest.post('/api/v1/plan/task/list', {
  57. stationId: this.currentStationId,
  58. workOrderCode: this.currentWorkOrderCode,
  59. operationId: this.currentOperationId,
  60. stateList: currentStateList
  61. } as RequestParamModel) as TaskSeqVO[];
  62. return res.length;
  63. }
  64. async handleAllClick(): Promise<void> {
  65. this.planReportNum = await this.onQueryTask([]);
  66. }
  67. async handleReportedClick(): Promise<void> {
  68. this.reportedNum = await this.onQueryTask([2]);
  69. }
  70. aboutToAppear(): void {
  71. this.loadFirstReport()
  72. }
  73. build() {
  74. Column() {
  75. Column() {
  76. Text("工序报工")
  77. .fontColor($r('app.color.FFFFFF'))
  78. .fontSize($r('app.float.fontSize_30'))
  79. }
  80. .height('8%')
  81. .width('100%')
  82. .justifyContent(FlexAlign.Center)
  83. Column(){
  84. Row(){
  85. Column({space:3}){
  86. Text(this.selectWorkOder.materialName)
  87. .fontSize($r('app.float.fontSize_24'))
  88. .fontColor($r('app.color.FFFFFF'))
  89. Text(this.selectWorkOder.materialCode)
  90. .fontSize($r('app.float.fontSize_12'))
  91. .fontColor($r('app.color.FFFFFF'))
  92. .fontWeight(FontWeight.Lighter)
  93. Row(){
  94. Text("工单 ")
  95. .fontSize($r('app.float.fontSize_16'))
  96. .fontColor($r('app.color.FFFFFF'))
  97. .fontWeight(FontWeight.Lighter)
  98. Text(this.selectWorkOder.workOrderCode)
  99. .fontSize($r('app.float.fontSize_16'))
  100. .fontColor($r('app.color.FFFFFF'))
  101. }
  102. }
  103. .height('100%')
  104. .width('30%')
  105. .justifyContent(FlexAlign.End)
  106. .alignItems(HorizontalAlign.Start)
  107. Row(){
  108. Text('工序')
  109. .fontSize($r('app.float.fontSize_16'))
  110. .fontColor($r('app.color.FFFFFF'))
  111. .fontWeight(FontWeight.Lighter)
  112. Text(this.selectProcessName)
  113. .fontSize($r('app.float.fontSize_16'))
  114. .fontColor($r('app.color.FFFFFF'))
  115. }
  116. .height('100%')
  117. .width('40%')
  118. .justifyContent(FlexAlign.Center)
  119. .alignItems(VerticalAlign.Bottom)
  120. Column(){
  121. Row(){
  122. Text(`${this.reportedNum}/`)
  123. .fontSize($r('app.float.fontSize_38'))
  124. .fontColor($r('app.color.FFFFFF'))
  125. Text(`${this.planReportNum}`)
  126. .fontSize($r('app.float.fontSize_38'))
  127. .fontColor($r('app.color.60FFFFFF'))
  128. }
  129. Text('当前工序已报工/计划')
  130. .fontSize($r('app.float.fontSize_12'))
  131. .fontColor($r('app.color.FFFFFF'))
  132. .fontWeight(FontWeight.Lighter)
  133. }
  134. .height('100%')
  135. .width('30%')
  136. .justifyContent(FlexAlign.End)
  137. .alignItems(HorizontalAlign.End)
  138. }
  139. .height('10%')
  140. .width('96%')
  141. .margin({left:'2%',right:'2%'})
  142. Row(){
  143. Image($r('app.media.process_reporting_add'))
  144. .width($r('app.float.virtualSize_24'))
  145. .height($r('app.float.virtualSize_24'))
  146. .fillColor($r('app.color.0A84FF'))
  147. Text('添加报工人')
  148. .fontColor($r('app.color.0A84FF'))
  149. .fontSize($r('app.float.fontSize_24'))
  150. .margin({left:'4%'})
  151. }
  152. .height('8%')
  153. .width('14%')
  154. .margin({left:'2%',top:'1.5%',bottom:'1.5%'})
  155. .justifyContent(FlexAlign.Center)
  156. .backgroundColor($r('app.color.20FFFFFF'))
  157. .borderRadius($r('app.float.virtualSize_16'))
  158. .scale({ x: this.addReportingClick, y: this.addReportingClick })
  159. .animation({
  160. duration: 200,
  161. curve: Curve.Linear
  162. })
  163. .onClick(() => {
  164. this.addReportingClick = 0.9;
  165. setTimeout(() => {
  166. this.addReportingClick = 1;
  167. const newReporter:ReportInfo= {}
  168. this.reportList.push(newReporter)
  169. }, 200);
  170. })
  171. Column(){
  172. List({space: 8, scroller:this.scrollerList}) {
  173. ForEach(this.reportList, (item:ReportInfo,index) => {
  174. ListItem() {
  175. Row(){
  176. Column(){
  177. Text(`报工人${index}`)
  178. .fontColor($r('app.color.FFFFFF'))
  179. .fontSize($r('app.float.fontSize_16'))
  180. .fontWeight(FontWeight.Regular)
  181. .height('30%')
  182. .margin({left:'2%'})
  183. Row(){
  184. Text(item.userName)
  185. .fontColor($r('app.color.FFFFFF'))
  186. .fontSize($r('app.float.fontSize_24'))
  187. .margin({left:'8%'})
  188. .width('82%')
  189. .textAlign(TextAlign.Start)
  190. Text(">")
  191. .fontColor($r('app.color.FFFFFF'))
  192. .fontSize($r('app.float.fontSize_24'))
  193. .textAlign(TextAlign.Start)
  194. .width('10%')
  195. }
  196. .justifyContent(FlexAlign.Start)
  197. .borderRadius($r('app.float.virtualSize_16'))
  198. .height('70%')
  199. .enabled(index!=0)
  200. .backgroundColor($r('app.color.20FFFFFF'))
  201. .onClick(()=>{
  202. this.onSelectReporter(index)
  203. this.currentReporterIndex = index;
  204. })
  205. }
  206. .width('29%')
  207. .height('100%')
  208. .alignItems(HorizontalAlign.Start)
  209. Column(){
  210. Text(`报工数量`)
  211. .fontColor($r('app.color.FFFFFF'))
  212. .fontSize($r('app.float.fontSize_16'))
  213. .fontWeight(FontWeight.Regular)
  214. .height('30%')
  215. .margin({left:'2%'})
  216. Row(){
  217. Text(item.reportNum)
  218. .fontColor($r('app.color.FFFFFF'))
  219. .fontSize($r('app.float.fontSize_24'))
  220. .margin({left:'8%'})
  221. .width('82%')
  222. .textAlign(TextAlign.Start)
  223. Text(">")
  224. .fontColor($r('app.color.FFFFFF'))
  225. .fontSize($r('app.float.fontSize_24'))
  226. .textAlign(TextAlign.Start)
  227. .width('10%')
  228. }
  229. .justifyContent(FlexAlign.Start)
  230. .borderRadius($r('app.float.virtualSize_16'))
  231. .height('70%')
  232. .backgroundColor($r('app.color.20FFFFFF'))
  233. .onClick(()=>{
  234. this.onSelectReportNum(index)
  235. })
  236. }
  237. .width('29%')
  238. .height('100%')
  239. .alignItems(HorizontalAlign.Start)
  240. .margin({left:'2%',right:'2%'})
  241. Column(){
  242. Text(`不良品数量`)
  243. .fontColor($r('app.color.FFFFFF'))
  244. .fontSize($r('app.float.fontSize_16'))
  245. .fontWeight(FontWeight.Regular)
  246. .height('30%')
  247. .margin({left:'2%'})
  248. Row(){
  249. Text(item.unqualifiedNum)
  250. .fontColor($r('app.color.FFFFFF'))
  251. .fontSize($r('app.float.fontSize_24'))
  252. .margin({left:'8%'})
  253. .width('82%')
  254. .textAlign(TextAlign.Start)
  255. Text(">")
  256. .fontColor($r('app.color.FFFFFF'))
  257. .fontSize($r('app.float.fontSize_24'))
  258. .textAlign(TextAlign.Start)
  259. .width('10%')
  260. }
  261. .justifyContent(FlexAlign.Start)
  262. .borderRadius($r('app.float.virtualSize_16'))
  263. .backgroundColor($r('app.color.20FFFFFF'))
  264. .height('70%')
  265. .onClick(()=>{
  266. this.onSelectUnqualified(index)
  267. })
  268. }
  269. .width('29%')
  270. .alignItems(HorizontalAlign.Start)
  271. .height('100%')
  272. if(index>0)
  273. {
  274. Column(){
  275. Image($r('app.media.process_delete_seq'))
  276. .width($r('app.float.virtualSize_48'))
  277. .height($r('app.float.virtualSize_48'))
  278. .fillColor($r('app.color.FF453A'))
  279. .margin({top:'35%'})
  280. .onClick(()=>{
  281. this.reportList.splice(index,1)
  282. this.bindTaskSeq = this.bindTaskSeq.filter(i => i.userName !== item.userName);
  283. })
  284. }
  285. .width('9%')
  286. .alignItems(HorizontalAlign.Center)
  287. .height('100%')
  288. }
  289. }
  290. .height('100%')
  291. }.height('20%')
  292. })
  293. }
  294. .width('98%')
  295. .height('100%')
  296. .margin({left:'2%'})
  297. }
  298. .height('74%')
  299. .width('100%')
  300. }
  301. .justifyContent(FlexAlign.Start)
  302. .alignItems(HorizontalAlign.Start)
  303. .width('100%')
  304. .height('84%')
  305. Column() {
  306. Divider()
  307. .vertical(false)
  308. .strokeWidth(1)
  309. .color($r('app.color.15FFFFFF'))
  310. Row() {
  311. Row() {
  312. Text('取消')
  313. .fontColor($r('app.color.60FFFFFF'))
  314. .fontSize($r('app.float.fontSize_30'))
  315. }
  316. .justifyContent(FlexAlign.Center)
  317. .width('50%')
  318. .onClick(() => this.controller.close())
  319. Divider()
  320. .vertical(true)
  321. .strokeWidth(1)
  322. .color($r('app.color.15FFFFFF'))
  323. Row() {
  324. Text('确认报工')
  325. .fontColor($r('app.color.007AFF'))
  326. .fontSize($r('app.float.fontSize_30'))
  327. }
  328. .justifyContent(FlexAlign.Center)
  329. .width('50%')
  330. .onClick(() => {
  331. this.controller.close();
  332. })
  333. }
  334. }
  335. .width('100%')
  336. .height('8%')
  337. }
  338. .height('71%')
  339. .width('62%')
  340. .backgroundColor($r('app.color.2A2A2A'))
  341. .justifyContent(FlexAlign.End)
  342. .alignItems(HorizontalAlign.Start)
  343. .borderColor($r('app.color.000000'))
  344. .borderWidth(1)
  345. .borderRadius($r('app.float.virtualSize_16'))
  346. }
  347. }