Commit 7d3adf6a1862fe1ae13495ba79620d24afd5c70d

Authored by 陈强
1 parent 9495e9bc

CPS体系驾驶舱-定时任务根据考勤记录自动生成过程确认计划优化修改

... ... @@ -42,6 +42,14 @@ public class PjoExecDetailDTO implements Serializable {
42 42 * 当日生产班次
43 43 */
44 44 private String drscbc;
  45 + /*
  46 + * 当日生产班次名称
  47 + */
  48 + private String drscbcName;
  49 + /*
  50 + * 当日生产班次编号
  51 + */
  52 + private String drscbcCode;
45 53
46 54 /*
47 55 * PJO执行人id(组织用户)
... ...
1 1 package com.qgutech.qgyun.apaas.sync.cps.service;
2 2
  3 +import com.qgutech.qgyun.apaas.sync.cps.model.*;
3 4 import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
4 5 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
5 6 import com.qgutech.qgyun.apaas.sync.base.BoException;
... ... @@ -10,13 +11,6 @@ import com.qgutech.qgyun.apaas.sync.cps.enums.GwxzEnum;
10 11 import com.qgutech.qgyun.apaas.sync.cps.enums.PjoExecZtEnum;
11 12 import com.qgutech.qgyun.apaas.sync.cps.enums.ZyczdwtEnum;
12 13 import com.qgutech.qgyun.apaas.sync.cps.mapper.PjoExecMapper;
13   -import com.qgutech.qgyun.apaas.sync.cps.model.Area;
14   -import com.qgutech.qgyun.apaas.sync.cps.model.PjoBatch;
15   -import com.qgutech.qgyun.apaas.sync.cps.model.PjoExec;
16   -import com.qgutech.qgyun.apaas.sync.cps.model.PjoWorkstationExec;
17   -import com.qgutech.qgyun.apaas.sync.cps.model.Team;
18   -import com.qgutech.qgyun.apaas.sync.cps.model.Workshop;
19   -import com.qgutech.qgyun.apaas.sync.cps.model.XtLine;
20 14 import com.qgutech.qgyun.apaas.sync.org.model.UcUser;
21 15 import com.qgutech.qgyun.apaas.sync.org.service.UcUserService;
22 16 import com.qgutech.qgyun.apaas.sync.utils.DateDealUtils;
... ... @@ -45,6 +39,8 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> {
45 39 private PjoExecMapper pjoExecMapper;
46 40
47 41 @Resource
  42 + private ShiftService shiftService;
  43 + @Resource
48 44 private WorkshopService workshopService;
49 45
50 46 @Resource
... ... @@ -330,6 +326,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> {
330 326 }
331 327
332 328 // 3. 收集所有关联实体ID
  329 + Set<String> shiftIds = new HashSet<>();
333 330 Set<String> workshopIds = new HashSet<>();
334 331 Set<String> areaIds = new HashSet<>();
335 332 Set<String> teamIds = new HashSet<>();
... ... @@ -338,6 +335,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> {
338 335 Set<String> workstationIds = new HashSet<>();
339 336 Set<String> userIds = new HashSet<>();
340 337 for (PjoExec item : execList) {
  338 + if (StringUtils.isNotBlank(item.getDrscbc())) shiftIds.add(item.getDrscbc());
341 339 if (StringUtils.isNotBlank(item.getCj())) workshopIds.add(item.getCj());
342 340 if (StringUtils.isNotBlank(item.getQy())) areaIds.add(item.getQy());
343 341 if (StringUtils.isNotBlank(item.getBz())) teamIds.add(item.getBz());
... ... @@ -350,6 +348,8 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> {
350 348 }
351 349
352 350 // 4. 批量查询关联实体
  351 + Map<String, Shift> shiftMap = CollectionUtils.isEmpty(shiftIds)
  352 + ? new HashMap<>(0) : shiftService.mapByIds(shiftIds);
353 353 Map<String, Workshop> workshopMap = CollectionUtils.isEmpty(workshopIds)
354 354 ? new HashMap<>(0) : workshopService.mapByIds(workshopIds);
355 355 Map<String, Area> areaMap = CollectionUtils.isEmpty(areaIds)
... ... @@ -366,7 +366,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> {
366 366 ? new HashMap<>(0) : ucUserService.mapByIds(userIds);
367 367
368 368 // 5. 组装明细结果
369   - List<PjoExecDetailDTO> resultList = buildDetailList(execList, workshopMap, areaMap,
  369 + List<PjoExecDetailDTO> resultList = buildDetailList(execList, shiftMap, workshopMap, areaMap,
370 370 teamMap, xtLineMap, batchMap, workstationMap, userMap);
371 371
372 372 // 6. 按 PJO 开展日期降序排序,为空的排在最后
... ... @@ -379,6 +379,7 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> {
379 379 * 组装 PJO 计划执行记录明细 DTO 列表(含枚举名称、关联实体名称、各阶段问题标记)
380 380 */
381 381 private List<PjoExecDetailDTO> buildDetailList(List<PjoExec> execList,
  382 + Map<String, Shift> shiftMap,
382 383 Map<String, Workshop> workshopMap,
383 384 Map<String, Area> areaMap,
384 385 Map<String, Team> teamMap,
... ... @@ -444,6 +445,14 @@ public class PjoExecService extends BaseServiceImpl<PjoExec> {
444 445 dto.setGwzx2Code(ws.getGwbh());
445 446 }
446 447 }
  448 + // 班次
  449 + if (item.getDrscbc() != null) {
  450 + Shift shift = shiftMap.get(item.getDrscbc());
  451 + if (shift != null) {
  452 + dto.setDrscbcName(shift.getBcmc());
  453 + dto.setDrscbcCode(shift.getBcbh());
  454 + }
  455 + }
447 456 // 车间
448 457 if (item.getCj() != null) {
449 458 Workshop workshop = workshopMap.get(item.getCj());
... ...
... ... @@ -563,8 +563,8 @@ public class ProcessConfirmExecService extends BaseServiceImpl<ProcessConfirmExe
563 563 continue;
564 564 }
565 565 // 当天已有计划的不再生成(含本次已处理的,避免同一人多条考勤重复生成)
566   - if (existingPersonnelIds.contains(personnel.getId())
567   - || !handledPersonnelIds.add(personnel.getId())) {
  566 + if (existingPersonnelIds.contains(personnel.getRy())
  567 + || !handledPersonnelIds.add(personnel.getRy())) {
568 568 continue;
569 569 }
570 570 toCreateList.add(buildDailyExec(attendance, user, personnel, start));
... ...
... ... @@ -23,7 +23,7 @@ public class CpsScheduledTask {
23 23 * 根据每日考勤记录自动生成过程确认计划
24 24 * 定时任务执行-每隔30分钟执行一次
25 25 */
26   - @Scheduled(cron = "0 21 * * * ?")
  26 + @Scheduled(cron = "0 */30 * * * ?")
27 27 public void autoCreateProcessConfirmExecByDailySign() {
28 28 try {
29 29 int count = processConfirmExecService.autoCreateProcessConfirmExecByDailySign(null, null);
... ...