Merge remote-tracking branch 'origin/dev_New_pro' into dev_New_pro
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | alter table sys_user |
| | | add ai_enabled tinyint(1) not null default 0 comment 'æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼'; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ç¨æ· AI åè½å段å端èè°è¯´æ |
| | | |
| | | ## èæ¯ |
| | | |
| | | å端已å¨ç¨æ·è¡¨å¢å éèåæ®µ `ai_enabled`ï¼ç¨äºæ è¯ç¨æ·æ¯å¦å¼é AI åè½ã |
| | | è¯¥åæ®µä¸å¼æ¾ç»ç¨æ·èµæç»´æ¤æ¥å£ï¼ä¸éè¿ç¨æ·ç¼è¾é¡µé¢ä¸å/ååï¼ã |
| | | |
| | | ## åæ®µå®ä¹ |
| | | |
| | | | åæ®µ | ç±»å | é»è®¤å¼ | 说æ | |
| | | | --- | --- | --- | --- | |
| | | | ai_enabled | tinyint(1) | 0 | æ¯å¦å¼é AI åè½ï¼`0`=æªå¼éï¼`1`=å·²å¼é | |
| | | |
| | | ## èè°æ¥å£ |
| | | |
| | | ç»å½åè°ç¨ï¼ |
| | | |
| | | ```http |
| | | GET /getInfo |
| | | ``` |
| | | |
| | | è¿å䏿°å¢é¡¶å±å段 `aiEnabled`ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "user": { |
| | | "userId": 1, |
| | | "userName": "admin" |
| | | }, |
| | | "aiEnabled": 1, |
| | | "roles": [ |
| | | "admin" |
| | | ], |
| | | "permissions": [ |
| | | "*:*:*" |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ## å端使ç¨å»ºè®® |
| | | |
| | | 1. ç»å½æååæç°ææµç¨è°ç¨ `/getInfo`ã |
| | | 2. ä»ååºé¡¶å±è¯»å `aiEnabled`ã |
| | | 3. å¤å®é»è¾å»ºè®®ï¼ |
| | | - `aiEnabled === 1`ï¼å±ç¤º/æ¾å¼ AI ç¸å
³å
¥å£ã |
| | | - å
¶ä»å¼ï¼`0`ã`null`ã`undefined`ï¼ï¼ææªå¼éå¤çã |
| | | |
| | | ## ç¼å说æ |
| | | |
| | | - `aiEnabled` å·²æ¾å
¥ç»å½ç¼å对象ï¼`LoginUser`ï¼å¹¶é token çå½å¨æç®¡çã |
| | | - ç¼å key åç¼ï¼`login_tokens:`ã |
| | |
| | | */
|
| | | private Long tenantId;
|
| | |
|
| | | /**
|
| | | * å½åé¨é¨id
|
| | | */
|
| | | /** |
| | | * å½åé¨é¨id |
| | | */ |
| | | private Long currentDeptId; |
| | | |
| | | /** |
| | | * æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼ |
| | | */ |
| | | private Integer aiEnabled; |
| | | |
| | | private String dataScope; |
| | |
|
| | |
| | | {
|
| | | }
|
| | |
|
| | | public LoginUser(SysUser user, Set<String> permissions)
|
| | | {
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | }
|
| | | public LoginUser(SysUser user, Set<String> permissions) |
| | | { |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptId;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptId; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptIds;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | this.tenantId = tenantId;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptIds; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.tenantId = tenantId; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptIds;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | this.tenantId = tenantId;
|
| | | this.currentDeptId = currentDeptId;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptIds; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.tenantId = tenantId; |
| | | this.currentDeptId = currentDeptId; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public Long getUserId()
|
| | | {
|
| | |
| | | return user;
|
| | | }
|
| | |
|
| | | public void setUser(SysUser user)
|
| | | {
|
| | | this.user = user;
|
| | | }
|
| | | public void setUser(SysUser user) |
| | | { |
| | | this.user = user; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | @Override
|
| | | public Collection<? extends GrantedAuthority> getAuthorities()
|
| | |
| | | this.currentDeptId = currentDeptId; |
| | | } |
| | | |
| | | public Integer getAiEnabled() { |
| | | if (aiEnabled != null) { |
| | | return aiEnabled; |
| | | } |
| | | if (user != null && user.getAiEnabled() != null) { |
| | | return user.getAiEnabled(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public void setAiEnabled(Integer aiEnabled) { |
| | | this.aiEnabled = aiEnabled; |
| | | } |
| | | |
| | | public String getDataScope() { |
| | | return dataScope; |
| | | } |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | |
| | | |
| | | @Schema(description = "宿è¿åº¦") |
| | | private BigDecimal completionStatus; |
| | | |
| | | @Schema(description = "订åå·") |
| | | private String npsNo; |
| | | |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startDate; |
| | | |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | } |
| | |
| | | @Schema(description = "å·¥åç±»å æ£å¸¸/è¿å·¥è¿ä¿®") |
| | | private String workOrderType; |
| | | |
| | | @Schema(description = "çäº§ä»»å¡æ°") |
| | | private Long productionTaskCount; |
| | | |
| | | @Schema(description = "è¯åæ°") |
| | | private BigDecimal goodQuantity; |
| | | |
| | | @Schema(description = "æ¥åºæ°é") |
| | | private BigDecimal scrapQty; |
| | | |
| | | @Schema(description = "宿è¿åº¦") |
| | | private BigDecimal completionStatus; |
| | | |
| | |
| | | |
| | | @Schema(description = "宿è¿åº¦") |
| | | private BigDecimal completionStatus; |
| | | |
| | | @Schema(description = "æ¯å¦å·²éæ") |
| | | private Boolean returned; |
| | | } |
| | |
| | | package com.ruoyi.production.bean.vo; |
| | | |
| | | import com.ruoyi.production.pojo.ProductionOperationTask; |
| | | import com.ruoyi.production.pojo.ProductionOrderRoutingOperationParam; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.production.pojo.ProductionProductOutput; |
| | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Schema(name = "ProductionOrderWorkOrderDetailVo", description = "Production order work order/report/inspect detail") |
| | | @Schema(name = "ProductionOrderWorkOrderDetailVo", description = "ç产追溯è¿å对象") |
| | | public class ProductionOrderWorkOrderDetailVo { |
| | | |
| | | @Schema(description = "Production order info") |
| | | @Schema(description = "订å") |
| | | private ProductionOrderVo productionOrder; |
| | | |
| | | @Schema(description = "Work order list") |
| | | @Schema(description = "å·¥åæç»å表") |
| | | private List<WorkOrderDetail> workOrderList; |
| | | |
| | | @Data |
| | | @Schema(name = "WorkOrderDetail", description = "Work order detail") |
| | | @Schema(name = "WorkOrderDetail", description = "å·¥åæç»") |
| | | public static class WorkOrderDetail { |
| | | |
| | | @Schema(description = "Work order info") |
| | | private ProductionOperationTask workOrder; |
| | | @Schema(description = "å·¥åä¿¡æ¯") |
| | | private ProductionOperationTaskVo workOrder; |
| | | |
| | | @Schema(description = "Report list under current work order") |
| | | @Schema(description = "æ¥å·¥è¯¦æ
å表") |
| | | private List<ReportDetail> reportList; |
| | | } |
| | | |
| | | @Data |
| | | @Schema(name = "ReportDetail", description = "Production report detail") |
| | | public static class ReportDetail { |
| | | |
| | | @Schema(description = "Report main info") |
| | | private ProductionProductMain reportMain; |
| | | |
| | | @Schema(description = "Report output list") |
| | | private List<ProductionProductOutput> reportOutputList; |
| | | |
| | | @Schema(description = "Report process param list") |
| | | private List<ProductionOrderRoutingOperationParam> reportParamList; |
| | | |
| | | @Schema(description = "Inspect list under current report") |
| | | @Schema(description = "è´¨æ£è¯¦æ
å表") |
| | | private List<InspectDetail> inspectList; |
| | | } |
| | | |
| | | @Data |
| | | @Schema(name = "InspectDetail", description = "Quality inspect detail") |
| | | @Schema(name = "ReportDetail", description = "æ¥å·¥è¯¦æ
") |
| | | public static class ReportDetail { |
| | | |
| | | @Schema(description = "æ¥å·¥ä¸»ä¿¡æ¯") |
| | | private ProductionProductMain reportMain; |
| | | |
| | | @Schema(description = "æ¥å·¥äº§åºæç»") |
| | | private List<ProductionProductOutput> reportOutputList; |
| | | |
| | | @Schema(description = "æ¥å·¥å·¥åºåæ°") |
| | | private List<ProductionOrderRoutingOperationParam> reportParamList; |
| | | } |
| | | |
| | | @Data |
| | | @Schema(name = "InspectDetail", description = "è´¨æ£è¯¦æ
") |
| | | public static class InspectDetail { |
| | | |
| | | @Schema(description = "Inspect main info") |
| | | @Schema(description = "æ¥å·¥ID") |
| | | private Long reportId; |
| | | |
| | | @Schema(description = "æ¥å·¥åå·") |
| | | private String reportNo; |
| | | |
| | | @Schema(description = "æ¥å·¥ä¸»ä¿¡æ¯") |
| | | private ProductionProductMain reportMain; |
| | | |
| | | @Schema(description = "è´¨æ£ä¸»ä¿¡æ¯") |
| | | private QualityInspect inspect; |
| | | |
| | | @Schema(description = "Inspect param list") |
| | | @Schema(description = "è´¨æ£ææ æç»") |
| | | private List<QualityInspectParam> inspectParamList; |
| | | |
| | | @Schema(description = "Inspect attachment list") |
| | | @Schema(description = "è´¨æ£éä»¶å表") |
| | | private List<QualityInspectFile> inspectFileList; |
| | | } |
| | | } |
| | |
| | | return R.ok(productionOperationTaskService.assign(dto)); |
| | | } |
| | | |
| | | /** |
| | | * å·¥åæµè½¬å¡ä¸è½½ |
| | | * @param response |
| | | * @param dto |
| | | */ |
| | | @PostMapping("/down") |
| | | @Operation(summary = "å·¥åæµè½¬å¡ä¸è½½") |
| | | public void down(HttpServletResponse response, @RequestBody ProductionOperationTaskDto dto) { |
| | | productionOperationTaskService.down(response, dto); |
| | | } |
| | | |
| | | @GetMapping("/getOperation") |
| | | @Operation(summary = "å·¥åºè¯¦æ
æ¥è¯¢") |
| | | public R<List<ProductionOperationTaskVo>> getOperation(ProductionOperationTaskDto dto) { |
| | | return R.ok(productionOperationTaskService.getOperation(dto)); |
| | | } |
| | | |
| | | } |
| | |
| | | return R.ok(productionOrderService.pick(productionOrderId)); |
| | | } |
| | | |
| | | @GetMapping("/workOrder/detail/{productionOrderId}") |
| | | @Operation(summary = "Query work orders/reports/inspects by production order id") |
| | | public R<ProductionOrderWorkOrderDetailVo> getWorkOrderReportInspectDetail(@PathVariable Long productionOrderId) { |
| | | return R.ok(productionOrderService.getWorkOrderReportInspectDetail(productionOrderId)); |
| | | @GetMapping("/ordeDetail") |
| | | @Operation(summary = "ç产追溯") |
| | | public R<ProductionOrderWorkOrderDetailVo> getWorkOrderReportInspectDetail(ProductionOrderDto productionOrderDto) { |
| | | return R.ok(productionOrderService.getWorkOrderReportInspectDetail(productionOrderDto)); |
| | | } |
| | | |
| | | @Operation(summary = "æ´æ°è®¢åç¶æ") |
| | |
| | | @Param("processIds") List<Long> processIds); |
| | | |
| | | ProductionOperationTaskDto getProductWorkOrderFlowCard(@Param("id") Long id); |
| | | |
| | | List<ProductionOperationTaskVo> getOperation(@Param("c") ProductionOperationTaskDto dto); |
| | | } |
| | |
| | | boolean assign(ProductionOperationTaskDto dto); |
| | | |
| | | void down(HttpServletResponse response, ProductionOperationTaskDto dto); |
| | | |
| | | List<ProductionOperationTaskVo> getOperation(ProductionOperationTaskDto dto); |
| | | } |
| | |
| | | |
| | | List<ProductionOrderPickVo> pick(Long productionOrderId); |
| | | |
| | | ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(Long productionOrderId); |
| | | ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(ProductionOrderDto productionOrderDto); |
| | | |
| | | int updateOrder(ProductionOrderDto productionOrderDto); |
| | | } |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionOperationTaskVo> getOperation(ProductionOperationTaskDto dto) { |
| | | return baseMapper.getOperation(dto); |
| | | } |
| | | } |
| | |
| | | if (dto.getProductModelId() == null) { |
| | | throw new ServiceException("第" + rowNo + "æ¡äº§åè§æ ¼IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getPickQuantity() == null || dto.getPickQuantity().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ServiceException("第" + rowNo + "æ¡é¢ææ°éå¿
须大äº0"); |
| | | if (dto.getPickQuantity() == null || dto.getPickQuantity().compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("第" + rowNo + "æ¡é¢ææ°éä¸è½å°äº0"); |
| | | } |
| | | if (dto.getPickType() != null && dto.getPickType() != PICK_TYPE_NORMAL && dto.getPickType() != PICK_TYPE_FEEDING) { |
| | | throw new ServiceException("第" + rowNo + "æ¡é¢æç±»ååªè½æ¯1æ2"); |
| | |
| | | if (dto.getId() == null) { |
| | | throw new ServiceException("第" + rowNo + "æ¡é¢æIDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (dto.getFeedingQuantity() == null || dto.getFeedingQuantity().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ServiceException("第" + rowNo + "æ¡æ¬æ¬¡è¡¥ææ°éå¿
须大äº0"); |
| | | if (dto.getFeedingQuantity() == null || dto.getFeedingQuantity().compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("第" + rowNo + "æ¡æ¬æ¬¡è¡¥ææ°éä¸è½å°äº0"); |
| | | } |
| | | if (!isFeedingPick(dto)) { |
| | | throw new ServiceException("第" + rowNo + "æ¡è¡¥æç±»åå¿
须为2"); |
| | |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.constant.StorageAttachmentConstants; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.production.bean.dto.ProductionOperationTaskDto; |
| | | import com.ruoyi.production.bean.dto.ProductionOrderDto; |
| | | import com.ruoyi.production.bean.vo.ProductionBomStructureVo; |
| | | import com.ruoyi.production.bean.vo.ProductionOperationTaskVo; |
| | | import com.ruoyi.production.bean.vo.ProductionOrderPickVo; |
| | | import com.ruoyi.production.bean.vo.ProductionOrderVo; |
| | | import com.ruoyi.production.bean.vo.ProductionPlanVo; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(Long productionOrderId) { |
| | | if (productionOrderId == null) { |
| | | throw new ServiceException("productionOrderId can not be null"); |
| | | } |
| | | public ProductionOrderWorkOrderDetailVo getWorkOrderReportInspectDetail(ProductionOrderDto dto) { |
| | | Long productionOrderId = resolveProductionOrderId(dto); |
| | | ProductionOrderVo orderInfo = getProductionOrderInfo(productionOrderId); |
| | | if (orderInfo == null) { |
| | | throw new ServiceException("production order not found"); |
| | | throw new ServiceException("ç产订åä¸åå¨"); |
| | | } |
| | | |
| | | ProductionOrderWorkOrderDetailVo detailVo = new ProductionOrderWorkOrderDetailVo(); |
| | | detailVo.setProductionOrder(orderInfo); |
| | | |
| | | List<ProductionOperationTask> workOrderList = productionOperationTaskMapper.selectList( |
| | | Wrappers.<ProductionOperationTask>lambdaQuery() |
| | | .eq(ProductionOperationTask::getProductionOrderId, productionOrderId) |
| | | .orderByAsc(ProductionOperationTask::getId)); |
| | | ProductionOperationTaskDto taskQuery = new ProductionOperationTaskDto(); |
| | | taskQuery.setProductionOrderId(productionOrderId); |
| | | IPage<ProductionOperationTaskVo> workOrderPage = productionOperationTaskMapper.pageProductionOperationTask( |
| | | new Page<ProductionOperationTaskVo>(1, -1), taskQuery); |
| | | List<ProductionOperationTaskVo> workOrderList = workOrderPage == null || workOrderPage.getRecords() == null |
| | | ? Collections.emptyList() |
| | | : workOrderPage.getRecords().stream() |
| | | .filter(Objects::nonNull) |
| | | .sorted(Comparator.comparing(ProductionOperationTaskVo::getId, Comparator.nullsLast(Comparator.naturalOrder()))) |
| | | .collect(Collectors.toList()); |
| | | if (workOrderList == null || workOrderList.isEmpty()) { |
| | | detailVo.setWorkOrderList(Collections.emptyList()); |
| | | return detailVo; |
| | | } |
| | | |
| | | List<Long> workOrderIdList = workOrderList.stream() |
| | | .map(ProductionOperationTask::getId) |
| | | .map(ProductionOperationTaskVo::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | List<ProductionProductMain> reportMainList = workOrderIdList.isEmpty() |
| | |
| | | Wrappers.<ProductionProductMain>lambdaQuery() |
| | | .in(ProductionProductMain::getProductionOperationTaskId, workOrderIdList) |
| | | .orderByAsc(ProductionProductMain::getId)); |
| | | Map<Long, List<ProductionProductMain>> reportMainMap = new LinkedHashMap<>(); |
| | | Map<Long, List<ProductionProductMain>> reportMainByWorkOrderMap = new LinkedHashMap<>(); |
| | | for (ProductionProductMain reportMain : reportMainList) { |
| | | if (reportMain == null || reportMain.getProductionOperationTaskId() == null) { |
| | | continue; |
| | | } |
| | | reportMainMap.computeIfAbsent(reportMain.getProductionOperationTaskId(), k -> new ArrayList<>()).add(reportMain); |
| | | reportMainByWorkOrderMap.computeIfAbsent(reportMain.getProductionOperationTaskId(), key -> new ArrayList<>()).add(reportMain); |
| | | } |
| | | |
| | | List<Long> reportMainIdList = reportMainList.stream() |
| | |
| | | if (inspect == null || inspect.getProductMainId() == null) { |
| | | continue; |
| | | } |
| | | inspectMap.computeIfAbsent(inspect.getProductMainId(), k -> new ArrayList<>()).add(inspect); |
| | | inspectMap.computeIfAbsent(inspect.getProductMainId(), key -> new ArrayList<>()).add(inspect); |
| | | } |
| | | |
| | | List<Long> inspectIdList = inspectList.stream() |
| | |
| | | } |
| | | |
| | | List<ProductionOrderWorkOrderDetailVo.WorkOrderDetail> workOrderDetailList = new ArrayList<>(); |
| | | for (ProductionOperationTask workOrder : workOrderList) { |
| | | for (ProductionOperationTaskVo workOrder : workOrderList) { |
| | | ProductionOrderWorkOrderDetailVo.WorkOrderDetail workOrderDetail = new ProductionOrderWorkOrderDetailVo.WorkOrderDetail(); |
| | | workOrderDetail.setWorkOrder(workOrder); |
| | | |
| | | List<ProductionProductMain> workOrderReportMainList = reportMainMap.get(workOrder.getId()); |
| | | if (workOrderReportMainList == null || workOrderReportMainList.isEmpty()) { |
| | | List<ProductionProductMain> workOrderReportMainList = reportMainByWorkOrderMap.getOrDefault(workOrder.getId(), Collections.emptyList()); |
| | | if (workOrderReportMainList.isEmpty()) { |
| | | workOrderDetail.setReportList(Collections.emptyList()); |
| | | workOrderDetail.setInspectList(Collections.emptyList()); |
| | | workOrderDetailList.add(workOrderDetail); |
| | | continue; |
| | | } |
| | | |
| | | List<ProductionOrderWorkOrderDetailVo.ReportDetail> reportDetailList = new ArrayList<>(); |
| | | List<ProductionOrderWorkOrderDetailVo.InspectDetail> inspectDetailList = new ArrayList<>(); |
| | | for (ProductionProductMain reportMain : workOrderReportMainList) { |
| | | Long reportMainId = reportMain.getId(); |
| | | |
| | | ProductionOrderWorkOrderDetailVo.ReportDetail reportDetail = new ProductionOrderWorkOrderDetailVo.ReportDetail(); |
| | | reportDetail.setReportMain(reportMain); |
| | | reportDetail.setReportOutputList(reportOutputMap.getOrDefault(reportMainId, Collections.emptyList())); |
| | | reportDetail.setReportParamList(reportParamMap.getOrDefault(reportMainId, Collections.emptyList())); |
| | | |
| | | List<QualityInspect> reportInspectList = inspectMap.get(reportMainId); |
| | | if (reportInspectList == null || reportInspectList.isEmpty()) { |
| | | reportDetail.setInspectList(Collections.emptyList()); |
| | | } else { |
| | | List<ProductionOrderWorkOrderDetailVo.InspectDetail> inspectDetailList = new ArrayList<>(); |
| | | for (QualityInspect inspect : reportInspectList) { |
| | | ProductionOrderWorkOrderDetailVo.InspectDetail inspectDetail = new ProductionOrderWorkOrderDetailVo.InspectDetail(); |
| | | inspectDetail.setInspect(inspect); |
| | | inspectDetail.setInspectParamList(inspectParamMap.getOrDefault(inspect.getId(), Collections.emptyList())); |
| | | inspectDetail.setInspectFileList(inspectFileMap.getOrDefault(inspect.getId(), Collections.emptyList())); |
| | | inspectDetailList.add(inspectDetail); |
| | | } |
| | | reportDetail.setInspectList(inspectDetailList); |
| | | } |
| | | reportDetailList.add(reportDetail); |
| | | |
| | | List<QualityInspect> reportInspectList = inspectMap.getOrDefault(reportMainId, Collections.emptyList()); |
| | | for (QualityInspect inspect : reportInspectList) { |
| | | ProductionOrderWorkOrderDetailVo.InspectDetail inspectDetail = new ProductionOrderWorkOrderDetailVo.InspectDetail(); |
| | | inspectDetail.setReportId(reportMainId); |
| | | inspectDetail.setReportNo(reportMain.getProductNo()); |
| | | inspectDetail.setReportMain(reportMain); |
| | | inspectDetail.setInspect(inspect); |
| | | inspectDetail.setInspectParamList(inspectParamMap.getOrDefault(inspect.getId(), Collections.emptyList())); |
| | | inspectDetail.setInspectFileList(inspectFileMap.getOrDefault(inspect.getId(), Collections.emptyList())); |
| | | inspectDetailList.add(inspectDetail); |
| | | } |
| | | } |
| | | |
| | | workOrderDetail.setReportList(reportDetailList); |
| | | workOrderDetail.setInspectList(inspectDetailList); |
| | | workOrderDetailList.add(workOrderDetail); |
| | | } |
| | | |
| | |
| | | return detailVo; |
| | | } |
| | | |
| | | private Long resolveProductionOrderId(ProductionOrderDto dto) { |
| | | if (dto == null) { |
| | | throw new ServiceException("è¯·ä¼ å
¥ç产订åIDæç产订åå·"); |
| | | } |
| | | if (dto.getId() != null) { |
| | | return dto.getId(); |
| | | } |
| | | if (dto.getNpsNo() == null || dto.getNpsNo().trim().isEmpty()) { |
| | | throw new ServiceException("è¯·ä¼ å
¥ç产订åIDæç产订åå·"); |
| | | } |
| | | ProductionOrder productionOrder = baseMapper.selectOne( |
| | | Wrappers.<ProductionOrder>lambdaQuery() |
| | | .eq(ProductionOrder::getNpsNo, dto.getNpsNo().trim()) |
| | | .last("limit 1")); |
| | | if (productionOrder == null || productionOrder.getId() == null) { |
| | | throw new ServiceException("ç产订åä¸åå¨"); |
| | | } |
| | | return productionOrder.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionOrderPickVo> pick(Long productionOrderId) { |
| | | if (productionOrderId == null) { |
| | |
| | | import com.ruoyi.project.system.domain.SysMenu;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
|
| | | import com.ruoyi.project.system.mapper.SysDeptMapper;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import com.ruoyi.project.system.service.ISysUserDeptService;
|
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.service.ISysMenuService; |
| | | import com.ruoyi.project.system.service.ISysUserDeptService; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
| | | {
|
| | | private SysLoginService loginService;
|
| | | private ISysMenuService menuService;
|
| | | private SysPermissionService permissionService;
|
| | | private TokenService tokenService;
|
| | | private ISysUserDeptService userDeptService;
|
| | | private SysDeptMapper sysDeptMapper;
|
| | | private SysPermissionService permissionService; |
| | | private TokenService tokenService; |
| | | private ISysUserDeptService userDeptService; |
| | | private ISysUserService userService; |
| | | private SysDeptMapper sysDeptMapper; |
| | |
|
| | | /**
|
| | | * ç»å½æ¹æ³
|
| | |
| | | public AjaxResult getInfo()
|
| | | {
|
| | | LoginUser loginUser = SecurityUtils.getLoginUser();
|
| | | SysUser user = loginUser.getUser();
|
| | | SysUser user = userService.selectUserById(loginUser.getUserId()); |
| | | if (user == null) |
| | | { |
| | | user = loginUser.getUser(); |
| | | } |
| | | else |
| | | { |
| | | loginUser.setUser(user); |
| | | loginUser.setAiEnabled(user.getAiEnabled()); |
| | | tokenService.setLoginUser(loginUser); |
| | | } |
| | | // è·åå½åç»å½å
¬å¸
|
| | | Long tenantId = loginUser.getTenantId();
|
| | | if(null != tenantId){
|
| | |
| | | loginUser.setPermissions(permissions);
|
| | | tokenService.refreshToken(loginUser);
|
| | | }
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("user", user);
|
| | | ajax.put("roles", roles);
|
| | | ajax.put("permissions", permissions);
|
| | | return ajax;
|
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("aiEnabled", loginUser.getAiEnabled()); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | | return ajax; |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.project.system.domain;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.TableField;
|
| | | import com.ruoyi.common.xss.Xss;
|
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.ruoyi.common.xss.Xss; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel.Type;
|
| | |
| | | @Excel(name = "è´¦å·ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨")
|
| | | private String status;
|
| | |
|
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */
|
| | | private String delFlag;
|
| | |
|
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | private String delFlag; |
| | | |
| | | /** æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼ */ |
| | | @JsonIgnore |
| | | private Integer aiEnabled; |
| | | |
| | | /** æåç»å½IP */
|
| | | @Excel(name = "æåç»å½IP", type = Type.EXPORT)
|
| | | private String loginIp;
|
| | |
| | | this.status = status;
|
| | | }
|
| | |
|
| | | public String getDelFlag()
|
| | | {
|
| | | return delFlag;
|
| | | }
|
| | | public String getDelFlag() |
| | | { |
| | | return delFlag; |
| | | } |
| | |
|
| | | public void setDelFlag(String delFlag)
|
| | | {
|
| | | this.delFlag = delFlag;
|
| | | }
|
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public Integer getAiEnabled() |
| | | { |
| | | return aiEnabled; |
| | | } |
| | | |
| | | public void setAiEnabled(Integer aiEnabled) |
| | | { |
| | | this.aiEnabled = aiEnabled; |
| | | } |
| | |
|
| | | public String getLoginIp()
|
| | | {
|
| | |
| | | .append("sex", getSex())
|
| | | .append("avatar", getAvatar())
|
| | | .append("password", getPassword())
|
| | | .append("status", getStatus())
|
| | | .append("delFlag", getDelFlag())
|
| | | .append("loginIp", getLoginIp())
|
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("aiEnabled", getAiEnabled()) |
| | | .append("loginIp", getLoginIp()) |
| | | .append("loginDate", getLoginDate())
|
| | | .append("createBy", getCreateBy())
|
| | | .append("createTime", getCreateTime())
|
| | |
| | | pm.model as model, |
| | | pm.unit as unit, |
| | | poro.operation_name as operationName, |
| | | ROUND(pot.complete_quantity / pot.plan_quantity * 100, 2) AS completionStatus, |
| | | IFNULL(scrapStat.scrapQty, 0) AS scrapQty, |
| | | ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus, |
| | | CASE |
| | | WHEN pot.work_order_no LIKE 'FG%' THEN 'è¿å·¥è¿ä¿®' |
| | | ELSE 'æ£å¸¸' |
| | |
| | | left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id |
| | | left join product_model pm on pm.id = ifnull(poro.product_model_id, po.product_model_id) |
| | | left join product p on pm.product_id = p.id |
| | | left join ( |
| | | select ppm.production_operation_task_id as taskId, |
| | | sum(ifnull(ppo.scrap_qty, 0)) as scrapQty |
| | | from production_product_main ppm |
| | | left join production_product_output ppo on ppo.production_product_main_id = ppm.id |
| | | group by ppm.production_operation_task_id |
| | | ) scrapStat on scrapStat.taskId = pot.id |
| | | <where> |
| | | <if test="c != null and c.id != null"> |
| | | and pot.id = #{c.id} |
| | | </if> |
| | | <if test="c != null and c.npsNo != null"> |
| | | and po.nps_no like concat('%', #{c.npsNo}, '%') |
| | | </if> |
| | | <if test="c != null and c.productionOrderId != null"> |
| | | and pot.production_order_id = #{c.productionOrderId} |
| | |
| | | WHERE pot.id = #{id} |
| | | </select> |
| | | |
| | | <select id="getOperation" resultType="com.ruoyi.production.bean.vo.ProductionOperationTaskVo"> |
| | | select poro.operation_name as operationName, |
| | | count(pot.id) as productionTaskCount, |
| | | sum(ifnull(pot.plan_quantity, 0)) as planQuantity, |
| | | sum(ifnull(pot.complete_quantity, 0)) as completeQuantity, |
| | | sum(ifnull(pot.complete_quantity, 0)) as goodQuantity, |
| | | sum(ifnull(outputStat.scrapQty, 0)) as scrapQty, |
| | | round( |
| | | case |
| | | when sum(ifnull(pot.plan_quantity, 0)) = 0 then 0 |
| | | else (sum(ifnull(pot.complete_quantity, 0)) + sum(ifnull(outputStat.scrapQty, 0))) |
| | | / sum(ifnull(pot.plan_quantity, 0)) * 100 |
| | | end, |
| | | 2 |
| | | ) as completionStatus |
| | | from production_operation_task pot |
| | | left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id |
| | | left join ( |
| | | select ppm.production_operation_task_id as taskId, |
| | | sum(ifnull(ppo.scrap_qty, 0)) as scrapQty |
| | | from production_product_main ppm |
| | | left join production_product_output ppo on ppo.production_product_main_id = ppm.id |
| | | group by ppm.production_operation_task_id |
| | | ) outputStat on outputStat.taskId = pot.id |
| | | <where> |
| | | <if test="c != null and c.startDate != null"> |
| | | and date(pot.create_time) >= #{c.startDate} |
| | | </if> |
| | | <if test="c != null and c.endDate != null"> |
| | | and date(pot.create_time) <= #{c.endDate} |
| | | </if> |
| | | <if test="c != null and c.planStartTime != null"> |
| | | and pot.plan_start_time >= #{c.planStartTime} |
| | | </if> |
| | | <if test="c != null and c.planEndTime != null"> |
| | | and pot.plan_end_time <= #{c.planEndTime} |
| | | </if> |
| | | <if test="c != null and c.productionOrderId != null"> |
| | | and pot.production_order_id = #{c.productionOrderId} |
| | | </if> |
| | | <if test="c != null and c.productionOrderRoutingOperationId != null"> |
| | | and pot.production_order_routing_operation_id = #{c.productionOrderRoutingOperationId} |
| | | </if> |
| | | <if test="c != null and c.status != null"> |
| | | and pot.status = #{c.status} |
| | | </if> |
| | | <if test="c != null and c.processName != null and c.processName != ''"> |
| | | and poro.operation_name like concat('%', #{c.processName}, '%') |
| | | </if> |
| | | </where> |
| | | group by poro.operation_name |
| | | order by min(poro.drag_sort), poro.operation_name |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="productName" property="productName" /> |
| | | <result column="model" property="model" /> |
| | | <result column="processRouteCode" property="processRouteCode" /> |
| | | <result column="returned" property="returned" /> |
| | | </resultMap> |
| | | |
| | | <sql id="ProductionOrderVoColumns"> |
| | |
| | | po.is_end_order as endOrder, |
| | | tr.process_route_code as processRouteCode, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | tb.bom_no as bomNo |
| | | tb.bom_no as bomNo, |
| | | pop_return.returned as returned |
| | | </sql> |
| | | |
| | | <sql id="ProductionOrderVoFrom"> |
| | |
| | | left join product p on pm.product_id = p.id |
| | | left join technology_routing tr on po.technology_routing_id = tr.id |
| | | left join technology_bom tb on tb.id = tr.bom_id |
| | | left join ( |
| | | select production_order_id as productionOrderId, |
| | | if(max(case when ifnull(is_returned, 0) = 1 then 1 else 0 end) = 1, true, false) as returned |
| | | from production_order_pick |
| | | group by production_order_id |
| | | ) pop_return on pop_return.productionOrderId = po.id |
| | | </sql> |
| | | |
| | | <sql id="ProductionOrderWhere"> |
| | |
| | | <result property="password" column="password" /> |
| | | <result property="status" column="status" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="aiEnabled" column="ai_enabled" /> |
| | | <result property="loginIp" column="login_ip" /> |
| | | <result property="loginDate" column="login_date" /> |
| | | <result property="createBy" column="create_by" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | select u.user_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.ai_enabled, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.tenant_id |
| | | from sys_user u |
| | | left join sys_user_role ur on u.user_id = ur.user_id |