cuilei
2025-06-20 ac4d1a5962441156ff22a0c87f4eacc083daa9a6
Merge remote-tracking branch 'origin/master'
已添加1个文件
已修改24个文件
1106 ■■■■ 文件已修改
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/vo/InspectionVo.java 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamInspectionOrderController.java 277 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderDetailController.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamThirdMaintenanceOrderDetailController.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamInspectionOrderMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamInspectionOrderMapper.xml 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamInspectionOrderService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalDto.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfoMonth.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentFaultInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentFaultInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentFaultInfoServiceImpl.java 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/InboundOrderController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IInboundOrderService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/InboundOrderServiceImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutboundOrderServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/utils/QrCodePrinterUtils.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/vo/InspectionVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,110 @@
package org.jeecg.modules.eam.vo;
import lombok.Data;
@Data
public class InspectionVo {
    private String seq;
    private String operator;//操作
    private String confirmUser;//巡查
    private String inspectionContent;
    private String dayTime;
    private String inspectionResult;
    private String day1;
    private String day2;
    private String day3;
    private String day4;
    private String day5;
    private String day6;
    private String day7;
    private String day8;
    private String day9;
    private String day10;
    private String day11;
    private String day12;
    private String day13;
    private String day14;
    private String day15;
    private String day16;
    private String day17;
    private String day18;
    private String day19;
    private String day20;
    private String day21;
    private String day22;
    private String day23;
    private String day24;
    private String day25;
    private String day26;
    private String day27;
    private String day28;
    private String day29;
    private String day30;
    private String day31;
    private String confirmUser1;
    private String confirmUser2;
    private String confirmUser3;
    private String confirmUser4;
    private String confirmUser5;
    private String confirmUser6;
    private String confirmUser7;
    private String confirmUser8;
    private String confirmUser9;
    private String confirmUser10;
    private String confirmUser11;
    private String confirmUser12;
    private String confirmUser13;
    private String confirmUser14;
    private String confirmUser15;
    private String confirmUser16;
    private String confirmUser17;
    private String confirmUser18;
    private String confirmUser19;
    private String confirmUser20;
    private String confirmUser21;
    private String confirmUser22;
    private String confirmUser23;
    private String confirmUser24;
    private String confirmUser25;
    private String confirmUser26;
    private String confirmUser27;
    private String confirmUser28;
    private String confirmUser29;
    private String confirmUser30;
    private String confirmUser31;
    private String operator1;
    private String operator2;
    private String operator3;
    private String operator4;
    private String operator5;
    private String operator6;
    private String operator7;
    private String operator8;
    private String operator9;
    private String operator10;
    private String operator11;
    private String operator12;
    private String operator13;
    private String operator14;
    private String operator15;
    private String operator16;
    private String operator17;
    private String operator18;
    private String operator19;
    private String operator20;
    private String operator21;
    private String operator22;
    private String operator23;
    private String operator24;
    private String operator25;
    private String operator26;
    private String operator27;
    private String operator28;
    private String operator29;
    private String operator30;
    private String operator31;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamInspectionOrderController.java
@@ -24,6 +24,7 @@
import org.jeecg.modules.eam.request.EamInspectionOrderRequest;
import org.jeecg.modules.eam.service.IEamInspectionOrderDetailService;
import org.jeecg.modules.eam.service.IEamInspectionOrderService;
import org.jeecg.modules.eam.vo.InspectionVo;
import org.jeecg.modules.flowable.domain.vo.WorkTaskDataVo;
import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,8 +33,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
 * @Description: ç‚¹æ£€å·¥å•
@@ -328,4 +331,278 @@
        return super.importExcel(request, response, EamInspectionOrder.class);
    }
    /**
     * æŠ¥è¡¨ä½¿ç”¨ qsw
     * 2025-6-19
     */
    @GetMapping("/findInspectionResult")
    public JSONObject findInspectionResult(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                          @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
                                          @RequestParam Map<String, Object> params) {
        String equipmentId = (String)params.get("equipmentId");
        String inspectionDate = (String)params.get("inspectionDate");
        List<InspectionVo> inspectionVos = new ArrayList<>();
        List<Map<String, Object>> inspectionStandard = eamInspectionOrderService.findInspectionStandard(equipmentId);
        for (Map<String, Object> map : inspectionStandard) {
            List<InspectionVo> dayInspectionResult = eamInspectionOrderService.findInspectionResult(equipmentId,(String)map.get("itemDemand"),inspectionDate);
            InspectionVo inspectionVo = new InspectionVo();
            inspectionVo.setInspectionContent((String)map.get("itemDemand"));
            Object seq = map.get("seq");
            inspectionVo.setSeq(seq.toString());
            for (InspectionVo vo : dayInspectionResult) {
                if("1".equals(vo.getDayTime())){
                    inspectionVo.setDay1(vo.getInspectionResult());
                    continue;
                }else if("2".equals(vo.getDayTime())){
                    inspectionVo.setDay2(vo.getInspectionResult());
                    continue;
                }else if("3".equals(vo.getDayTime())){
                    inspectionVo.setDay3(vo.getInspectionResult());
                    continue;
                }else if("4".equals(vo.getDayTime())){
                    inspectionVo.setDay4(vo.getInspectionResult());
                    continue;
                }else if("5".equals(vo.getDayTime())){
                    inspectionVo.setDay5(vo.getInspectionResult());
                    continue;
                }else if("6".equals(vo.getDayTime())){
                    inspectionVo.setDay6(vo.getInspectionResult());
                    continue;
                }else if("7".equals(vo.getDayTime())){
                    inspectionVo.setDay7(vo.getInspectionResult());
                    continue;
                }else if("8".equals(vo.getDayTime())){
                    inspectionVo.setDay8(vo.getInspectionResult());
                    continue;
                }else if("9".equals(vo.getDayTime())){
                    inspectionVo.setDay9(vo.getInspectionResult());
                    continue;
                }else if("10".equals(vo.getDayTime())){
                    inspectionVo.setDay10(vo.getInspectionResult());
                    continue;
                }else if("11".equals(vo.getDayTime())){
                    inspectionVo.setDay11(vo.getInspectionResult());
                    continue;
                }else if("12".equals(vo.getDayTime())){
                    inspectionVo.setDay12(vo.getInspectionResult());
                    continue;
                }else if("13".equals(vo.getDayTime())){
                    inspectionVo.setDay13(vo.getInspectionResult());
                    continue;
                }else if("14".equals(vo.getDayTime())){
                    inspectionVo.setDay14(vo.getInspectionResult());
                    continue;
                }else if("15".equals(vo.getDayTime())){
                    inspectionVo.setDay15(vo.getInspectionResult());
                    continue;
                }else if("16".equals(vo.getDayTime())){
                    inspectionVo.setDay16(vo.getInspectionResult());
                    continue;
                }else if("17".equals(vo.getDayTime())){
                    inspectionVo.setDay17(vo.getInspectionResult());
                    continue;
                }else if("18".equals(vo.getDayTime())){
                    inspectionVo.setDay18(vo.getInspectionResult());
                    continue;
                }else if("19".equals(vo.getDayTime())){
                    inspectionVo.setDay19(vo.getInspectionResult());
                    continue;
                }else if("20".equals(vo.getDayTime())){
                    inspectionVo.setDay20(vo.getInspectionResult());
                    continue;
                }else if("21".equals(vo.getDayTime())){
                    inspectionVo.setDay21(vo.getInspectionResult());
                    continue;
                }else if("22".equals(vo.getDayTime())){
                    inspectionVo.setDay22(vo.getInspectionResult());
                    continue;
                }else if("23".equals(vo.getDayTime())){
                    inspectionVo.setDay23(vo.getInspectionResult());
                    continue;
                }else if("24".equals(vo.getDayTime())){
                    inspectionVo.setDay24(vo.getInspectionResult());
                    continue;
                }else if("25".equals(vo.getDayTime())){
                    inspectionVo.setDay25(vo.getInspectionResult());
                    continue;
                }else if("26".equals(vo.getDayTime())){
                    inspectionVo.setDay26(vo.getInspectionResult());
                    continue;
                }else if("27".equals(vo.getDayTime())){
                    inspectionVo.setDay27(vo.getInspectionResult());
                    continue;
                }else if("28".equals(vo.getDayTime())){
                    inspectionVo.setDay28(vo.getInspectionResult());
                    continue;
                }else if("29".equals(vo.getDayTime())){
                    inspectionVo.setDay29(vo.getInspectionResult());
                    continue;
                }else if("30".equals(vo.getDayTime())){
                    inspectionVo.setDay30(vo.getInspectionResult());
                    continue;
                }else if("31".equals(vo.getDayTime())){
                    inspectionVo.setDay31(vo.getInspectionResult());
                    continue;
                }
            }
            inspectionVos.add(inspectionVo);
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("data",inspectionVos);
        return jsonObject;
    }
    /**
     * æŠ¥è¡¨ä½¿ç”¨ qsw
     * 2025-6-19
     */
    @GetMapping("/findInspectionUser")
    public JSONObject findInspectionUser(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                           @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
                                           @RequestParam Map<String, Object> params) {
        String equipmentId = (String)params.get("equipmentId");
        String inspectionDate = (String)params.get("inspectionDate");
        List<InspectionVo> inspectionVos = new ArrayList<>();
            List<InspectionVo> inspectionUser = eamInspectionOrderService.findInspectionUser(equipmentId,inspectionDate);
            InspectionVo inspectionVo = new InspectionVo();
            for (InspectionVo vo : inspectionUser) {
                if("1".equals(vo.getDayTime())){
                    inspectionVo.setOperator1(vo.getOperator());
                    inspectionVo.setConfirmUser1(vo.getConfirmUser());
                    continue;
                }else if("2".equals(vo.getDayTime())){
                    inspectionVo.setOperator2(vo.getOperator());
                    inspectionVo.setConfirmUser2(vo.getConfirmUser());
                    continue;
                }else if("3".equals(vo.getDayTime())){
                    inspectionVo.setOperator3(vo.getOperator());
                    inspectionVo.setConfirmUser3(vo.getConfirmUser());
                    continue;
                }else if("4".equals(vo.getDayTime())){
                    inspectionVo.setOperator4(vo.getOperator());
                    inspectionVo.setConfirmUser4(vo.getConfirmUser());
                    continue;
                }else if("5".equals(vo.getDayTime())){
                    inspectionVo.setOperator5(vo.getOperator());
                    inspectionVo.setConfirmUser5(vo.getConfirmUser());
                    continue;
                }else if("6".equals(vo.getDayTime())){
                    inspectionVo.setOperator6(vo.getOperator());
                    inspectionVo.setConfirmUser6(vo.getConfirmUser());
                    continue;
                }else if("7".equals(vo.getDayTime())){
                    inspectionVo.setOperator7(vo.getOperator());
                    inspectionVo.setConfirmUser7(vo.getConfirmUser());
                    continue;
                }else if("8".equals(vo.getDayTime())){
                    inspectionVo.setOperator8(vo.getOperator());
                    inspectionVo.setConfirmUser8(vo.getConfirmUser());
                    continue;
                }else if("9".equals(vo.getDayTime())){
                    inspectionVo.setOperator9(vo.getOperator());
                    inspectionVo.setConfirmUser9(vo.getConfirmUser());
                    continue;
                }else if("10".equals(vo.getDayTime())){
                    inspectionVo.setOperator10(vo.getOperator());
                    inspectionVo.setConfirmUser10(vo.getConfirmUser());
                    continue;
                }else if("11".equals(vo.getDayTime())){
                    inspectionVo.setOperator11(vo.getOperator());
                    inspectionVo.setConfirmUser11(vo.getConfirmUser());
                    continue;
                }else if("12".equals(vo.getDayTime())){
                    inspectionVo.setOperator12(vo.getOperator());
                    inspectionVo.setConfirmUser12(vo.getConfirmUser());
                    continue;
                }else if("13".equals(vo.getDayTime())){
                    inspectionVo.setOperator13(vo.getOperator());
                    inspectionVo.setConfirmUser13(vo.getConfirmUser());
                    continue;
                }else if("14".equals(vo.getDayTime())){
                    inspectionVo.setOperator14(vo.getOperator());
                    inspectionVo.setConfirmUser14(vo.getConfirmUser());
                    continue;
                }else if("15".equals(vo.getDayTime())){
                    inspectionVo.setOperator15(vo.getOperator());
                    inspectionVo.setConfirmUser15(vo.getConfirmUser());
                    continue;
                }else if("16".equals(vo.getDayTime())){
                    inspectionVo.setOperator16(vo.getOperator());
                    inspectionVo.setConfirmUser16(vo.getConfirmUser());
                    continue;
                }else if("17".equals(vo.getDayTime())){
                    inspectionVo.setOperator17(vo.getOperator());
                    inspectionVo.setConfirmUser17(vo.getConfirmUser());
                    continue;
                }else if("18".equals(vo.getDayTime())){
                    inspectionVo.setOperator18(vo.getOperator());
                    inspectionVo.setConfirmUser18(vo.getConfirmUser());
                    continue;
                }else if("19".equals(vo.getDayTime())){
                    inspectionVo.setOperator19(vo.getOperator());
                    inspectionVo.setConfirmUser19(vo.getConfirmUser());
                    continue;
                }else if("20".equals(vo.getDayTime())){
                    inspectionVo.setOperator20(vo.getOperator());
                    inspectionVo.setConfirmUser20(vo.getConfirmUser());
                    continue;
                }else if("21".equals(vo.getDayTime())){
                    inspectionVo.setOperator21(vo.getOperator());
                    inspectionVo.setConfirmUser21(vo.getConfirmUser());
                    continue;
                }else if("22".equals(vo.getDayTime())){
                    inspectionVo.setOperator22(vo.getOperator());
                    inspectionVo.setConfirmUser22(vo.getConfirmUser());
                    continue;
                }else if("23".equals(vo.getDayTime())){
                    inspectionVo.setOperator23(vo.getOperator());
                    inspectionVo.setConfirmUser23(vo.getConfirmUser());
                    continue;
                }else if("24".equals(vo.getDayTime())){
                    inspectionVo.setOperator24(vo.getOperator());
                    inspectionVo.setConfirmUser24(vo.getConfirmUser());
                    continue;
                }else if("25".equals(vo.getDayTime())){
                    inspectionVo.setOperator25(vo.getOperator());
                    inspectionVo.setConfirmUser25(vo.getConfirmUser());
                    continue;
                }else if("26".equals(vo.getDayTime())){
                    inspectionVo.setOperator26(vo.getOperator());
                    inspectionVo.setConfirmUser26(vo.getConfirmUser());
                    continue;
                }else if("27".equals(vo.getDayTime())){
                    inspectionVo.setOperator27(vo.getOperator());
                    inspectionVo.setConfirmUser27(vo.getConfirmUser());
                    continue;
                }else if("28".equals(vo.getDayTime())){
                    inspectionVo.setOperator28(vo.getOperator());
                    inspectionVo.setConfirmUser28(vo.getConfirmUser());
                    continue;
                }else if("29".equals(vo.getDayTime())){
                    inspectionVo.setOperator29(vo.getOperator());
                    inspectionVo.setConfirmUser29(vo.getConfirmUser());
                    continue;
                }else if("30".equals(vo.getDayTime())){
                    inspectionVo.setOperator30(vo.getOperator());
                    inspectionVo.setConfirmUser30(vo.getConfirmUser());
                    continue;
                }else if("31".equals(vo.getDayTime())){
                    inspectionVo.setOperator31(vo.getOperator());
                    inspectionVo.setConfirmUser31(vo.getConfirmUser());
                    continue;
                }
            }
            inspectionVos.add(inspectionVo);
//        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("data",inspectionVos);
        return jsonObject;
    }
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderDetailController.java
@@ -1,7 +1,9 @@
package org.jeecg.modules.eam.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -10,13 +12,16 @@
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrderDetail;
import org.jeecg.modules.eam.service.IEamSecondMaintenanceOrderDetailService;
import org.jeecg.modules.eam.vo.InspectionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @Description: è®¾å¤‡äºŒçº§ä¿å…»æ˜Žç»†
@@ -68,4 +73,44 @@
        List<EamSecondMaintenanceOrderDetail> list = eamSecondMaintenanceOrderDetailService.list(queryWrapper);
        return Result.OK(list);
    }
    /**
     * æŠ¥è¡¨ä½¿ç”¨ qsw
     * 2025-6-19
     */
    @GetMapping("/findExceptionDescriptionAll")
    public JSONObject findInspectionUser(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                         @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
                                         @RequestParam Map<String, Object> params) {
        String orderId = (String)params.get("id");
        List<EamSecondMaintenanceOrderDetail> details = new ArrayList<>();
        List<EamSecondMaintenanceOrderDetail> list = eamSecondMaintenanceOrderDetailService.lambdaQuery()
                .eq(EamSecondMaintenanceOrderDetail::getOrderId, orderId)
                .eq(EamSecondMaintenanceOrderDetail::getMaintenanceResult, "2")
                .list();
        EamSecondMaintenanceOrderDetail detail = new EamSecondMaintenanceOrderDetail();
        StringBuilder sb = new StringBuilder();
        int index = 1;
        for (EamSecondMaintenanceOrderDetail item : list) {
            String value = item.getExceptionDescription();
            if (value != null && !value.isEmpty()) { // è·³è¿‡null和空字符串
                sb.append(index).append(". ").append(value).append(System.lineSeparator());
                index++;
            }
        }
        // ç§»é™¤æœ€åŽä¸€ä¸ªå¤šä½™çš„æ¢è¡Œç¬¦ï¼ˆå¯é€‰ï¼‰
        if (sb.length() > 0) {
            sb.setLength(sb.length() - System.lineSeparator().length());
        }
        String s = sb.toString();
        detail.setExceptionDescription(s);
        details.add(detail);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("data",details);
        return jsonObject;
    }
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamThirdMaintenanceOrderDetailController.java
@@ -1,5 +1,6 @@
package org.jeecg.modules.eam.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -8,6 +9,7 @@
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrderDetail;
import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrderDetail;
import org.jeecg.modules.eam.service.IEamThirdMaintenanceOrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -16,7 +18,9 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @Description: è®¾å¤‡ä¸‰çº§ä¿å…»æ˜Žç»†
@@ -68,4 +72,44 @@
        List<EamThirdMaintenanceOrderDetail> list = eamThirdMaintenanceOrderDetailService.list(queryWrapper);
        return Result.OK(list);
    }
    /**
     * æŠ¥è¡¨ä½¿ç”¨ qsw
     * 2025-6-19
     */
    @GetMapping("/findExceptionDescriptionAll")
    public JSONObject findInspectionUser(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                         @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
                                         @RequestParam Map<String, Object> params) {
        String orderId = (String)params.get("id");
        List<EamThirdMaintenanceOrderDetail> details = new ArrayList<>();
        List<EamThirdMaintenanceOrderDetail> list = eamThirdMaintenanceOrderDetailService.lambdaQuery()
                .eq(EamThirdMaintenanceOrderDetail::getOrderId, orderId)
                .eq(EamThirdMaintenanceOrderDetail::getMaintenanceResult, "2")
                .list();
        EamThirdMaintenanceOrderDetail detail = new EamThirdMaintenanceOrderDetail();
        StringBuilder sb = new StringBuilder();
        int index = 1;
        for (EamThirdMaintenanceOrderDetail item : list) {
            String value = item.getExceptionDescription();
            if (value != null && !value.isEmpty()) { // è·³è¿‡null和空字符串
                sb.append(index).append(". ").append(value).append(System.lineSeparator());
                index++;
            }
        }
        // ç§»é™¤æœ€åŽä¸€ä¸ªå¤šä½™çš„æ¢è¡Œç¬¦ï¼ˆå¯é€‰ï¼‰
        if (sb.length() > 0) {
            sb.setLength(sb.length() - System.lineSeparator().length());
        }
        String s = sb.toString();
        detail.setExceptionDescription(s);
        details.add(detail);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("data",details);
        return jsonObject;
    }
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamInspectionOrderMapper.java
@@ -8,6 +8,10 @@
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.eam.entity.EamInspectionOrder;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
import org.jeecg.modules.eam.vo.InspectionVo;
import java.util.List;
import java.util.Map;
/**
 * @Description: ç‚¹æ£€å·¥å•
@@ -24,4 +28,12 @@
     * @return
     */
    IPage<EamInspectionOrder> queryPageList(Page<EamInspectionOrder> page, @Param(Constants.WRAPPER) QueryWrapper<EamInspectionOrder> queryWrapper);
    /**
     * ç‚¹æ£€æŠ¥è¡¨ new
     */
    List<InspectionVo> findInspectionResult(@Param("equipmentId")String equipmentId, @Param("itemDemand")String itemDemand,@Param("yearMonth")String yearMonth);
    List<InspectionVo> findInspectionUser(@Param("equipmentId")String equipmentId,@Param("yearMonth")String yearMonth);
    List<Map<String,Object>> findInspectionStandard(@Param("equipmentId")String equipmentId);
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamInspectionOrderMapper.xml
@@ -9,4 +9,46 @@
        on wmo.equipment_id = e.id
        ${ew.customSqlSegment}
    </select>
    <select id="findInspectionUser"  parameterType="String" resultType="org.jeecg.modules.eam.vo.InspectionVo">
        SELECT
            t1.operator,
            t1.confirm_user as confirmUser,
            CONVERT(VARCHAR, DATEPART(DAY, t1.inspection_date)) as dayTime
        FROM
            eam_inspection_order t1
        WHERE t1.del_flag = '0'
          AND t1.equipment_id = #{equipmentId}
        AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t1.inspection_date, 120 ), 1, 7 ) = SUBSTRING(CONVERT(VARCHAR(10),#{yearMonth}, 120 ), 1, 7 )
    </select>
    <select id="findInspectionResult"  parameterType="String" resultType="org.jeecg.modules.eam.vo.InspectionVo">
        SELECT
            t1.item_demand as inspectionContent,
            CONVERT(VARCHAR, DATEPART(DAY, t2.inspection_date)) as dayTime,
            case t1.inspection_result  when '1' then '√' when '2' then 'x' else '' end as inspectionResult
        FROM
            eam_inspection_order_detail t1
        LEFT JOIN eam_inspection_order t2 ON t1.order_id = t2.id
        WHERE t1.item_demand = #{itemDemand}
        and t2.equipment_id = #{equipmentId}
        AND SUBSTRING ( CONVERT ( VARCHAR ( 10 ), t2.inspection_date, 120 ), 1, 7 ) = SUBSTRING(CONVERT(VARCHAR(10),#{yearMonth}, 120 ), 1, 7 )
    </select>
    <select id="findInspectionStandard"  parameterType="String" resultType="Map">
        SELECT
            ROW_NUMBER() OVER (ORDER BY t1.id) AS seq,
            t1.item_demand as itemDemand
        FROM
            eam_maintenance_standard_detail t1
            LEFT JOIN eam_maintenance_standard t2 ON t1.standard_id = t2.id
        WHERE
          t2.maintenance_category = 'POINT_INSPECTION'
          AND t2.standard_status = 'NORMAL'
          and equipment_id =#{equipmentId}
        ORDER BY
            item_code ASC
    </select>
</mapper>
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamInspectionOrderService.java
@@ -7,8 +7,10 @@
import org.jeecg.modules.eam.entity.EamInspectionOrder;
import org.jeecg.modules.eam.request.EamInspectionOrderQuery;
import org.jeecg.modules.eam.request.EamInspectionOrderRequest;
import org.jeecg.modules.eam.vo.InspectionVo;
import java.util.List;
import java.util.Map;
/**
 * @Description: ç‚¹æ£€å·¥å•
@@ -82,4 +84,13 @@
     * @return
     */
    List<EamInspectionOrder> selectUnCompleteOrder(String expiredDate);
    /**
     * ç‚¹æ£€æŠ¥è¡¨ new
     */
    List<InspectionVo> findInspectionResult(String equipmentId, String itemDemand,String yearMonth);
    List<InspectionVo> findInspectionUser(String equipmentId,String yearMonth);
    List<Map<String,Object>> findInspectionStandard(String equipmentId);
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java
@@ -35,6 +35,7 @@
import org.jeecg.modules.eam.service.IEamInspectionOrderDetailService;
import org.jeecg.modules.eam.service.IEamInspectionOrderService;
import org.jeecg.modules.eam.service.IEamReportRepairService;
import org.jeecg.modules.eam.vo.InspectionVo;
import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl;
import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI;
@@ -540,4 +541,19 @@
        Object object = values.get("NextAssignee");
        return (List<String>) object;
    }
    @Override
    public List<InspectionVo> findInspectionResult(String equipmentId,String itemDemand,String yearMonth) {
        return this.baseMapper.findInspectionResult(equipmentId,itemDemand,yearMonth);
    }
    @Override
    public List<InspectionVo> findInspectionUser(String equipmentId,String yearMonth) {
        return this.baseMapper.findInspectionUser(equipmentId,yearMonth);
    }
    @Override
    public List<Map<String, Object>> findInspectionStandard(String equipmentId) {
        return this.baseMapper.findInspectionStandard(equipmentId);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalDto.java
@@ -37,6 +37,22 @@
     */
    private BigDecimal totalLong = new BigDecimal("0");
    /**
     * æ•…障时长
     */
    private BigDecimal faultLong = new BigDecimal("0");
    /**
     * æ•…障率
     */
    private BigDecimal faultRate = new BigDecimal("0");
    /**
     * è¿è¡Œæ—¶é•¿(去除故障时间)
     */
    private BigDecimal removeFaultRunLong = new BigDecimal("0");
    /**
     * åŽ»é™¤æ•…éšœæ—¶é—´åˆ©ç”¨çŽ‡
     */
    private BigDecimal removeFaultRate = new BigDecimal("0");
    /**
     * å¤©æ•°
     */
    private BigDecimal dayNum;
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfoMonth.java
@@ -78,6 +78,18 @@
    @ApiModelProperty(value = "报警时长")
    private Integer errorLong;
    /**
     * æ•…障时长
     */
    @Excel(name = "故障时长", width = 15)
    @ApiModelProperty(value = "故障时长")
    private Integer faultLong;
    /**
     * åŽ»é™¤æ•…éšœæ—¶é—´çš„è¿è¡Œæ—¶é—´
     */
    @Excel(name = "去除故障时间的运行时间", width = 15)
    @ApiModelProperty(value = "去除故障时间的运行时间")
    private Integer removeFaultRunLong;
    /**
     * åˆ©ç”¨çއ
     */
    @Excel(name = "利用率", width = 15)
@@ -96,6 +108,18 @@
    @ApiModelProperty(value = "开机率")
    private BigDecimal openRate;
    /**
     * æ•…障率
     */
    @Excel(name = "故障率", width = 15)
    @ApiModelProperty(value = "故障率")
    private BigDecimal faultRate;
    /**
     * åŽ»é™¤æ•…éšœæ—¶é—´åˆ©ç”¨çŽ‡
     */
    @Excel(name = "去除故障时间利用率", width = 15)
    @ApiModelProperty(value = "去除故障时间利用率")
    private BigDecimal removeFaultRate;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java
@@ -84,7 +84,7 @@
            if (StringUtils.isNotBlank(this.parameter)) {
                date = DateUtils.format(DateUtils.toDate(this.parameter, DateUtils.STRYEARMONTH), DateUtils.STRYEARMONTH);
            } else {
                date = DateUtils.format(DateUtils.getNow(), DateUtils.STRYEARMONTH);
                date = DateUtils.format(DateUtils.addMonth(-1, DateUtils.getNow()), DateUtils.STRYEARMONTH);
            }
            mdcEquipmentStatisticalInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalInfoMonth>().eq(MdcEquipmentStatisticalInfoMonth::getTheMonth, date));
            mdcEquipmentStatisticalShiftInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalShiftInfoMonth>().eq(MdcEquipmentStatisticalShiftInfoMonth::getTheMonth, date));
@@ -100,14 +100,20 @@
                    MdcEquipmentStatisticalInfoMonth mdcEquipmentStatisticalInfoMonth = new MdcEquipmentStatisticalInfoMonth();
                    mdcEquipmentStatisticalInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
                    mdcEquipmentStatisticalInfoMonth.setTheMonth(date);
                    mdcEquipmentStatisticalInfoMonth.setCloseLong(mdcEquipmentStatisticalDto.getCloseLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setErrorLong(mdcEquipmentStatisticalDto.getErrorLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setOpenLong(mdcEquipmentStatisticalDto.getOpenLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setProcessLong(mdcEquipmentStatisticalDto.getProcessLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setWaitLong(mdcEquipmentStatisticalDto.getWaitLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                    mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                    if (mdcEquipmentStatisticalDto != null) {
                        mdcEquipmentStatisticalInfoMonth.setCloseLong(mdcEquipmentStatisticalDto.getCloseLong().intValue());
                        mdcEquipmentStatisticalInfoMonth.setErrorLong(mdcEquipmentStatisticalDto.getErrorLong().intValue());
                        mdcEquipmentStatisticalInfoMonth.setOpenLong(mdcEquipmentStatisticalDto.getOpenLong().intValue());
                        mdcEquipmentStatisticalInfoMonth.setProcessLong(mdcEquipmentStatisticalDto.getProcessLong().intValue());
                        mdcEquipmentStatisticalInfoMonth.setWaitLong(mdcEquipmentStatisticalDto.getWaitLong().intValue());
                        mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                        mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                        mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                        mdcEquipmentStatisticalInfoMonth.setFaultLong(mdcEquipmentStatisticalDto.getFaultLong().intValue());
                        mdcEquipmentStatisticalInfoMonth.setFaultRate(mdcEquipmentStatisticalDto.getFaultRate());
                        mdcEquipmentStatisticalInfoMonth.setRemoveFaultRate(mdcEquipmentStatisticalDto.getRemoveFaultRate());
                        mdcEquipmentStatisticalInfoMonth.setRemoveFaultRunLong(mdcEquipmentStatisticalDto.getRemoveFaultRunLong().intValue());
                    }
                    mdcEquipmentStatisticalInfoMonthList.add(mdcEquipmentStatisticalInfoMonth);
                    // step.3 æ±‡æ€»ç­æ¬¡åˆ©ç”¨çŽ‡æ•°æ®
                    MdcEquipmentStatisticalDto mdcEquipmentShiftStatisticalDto = mdcEquipmentStatisticalShiftInfoService.findByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date);
@@ -115,15 +121,17 @@
                    mdcEquipmentShiftInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
                    mdcEquipmentShiftInfoMonth.setTheMonth(date);
                    mdcEquipmentShiftInfoMonth.setShiftType(CommonConstant.SHIFT_TYPE_1);
                    mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong().intValue());
                    mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong().intValue());
                    mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong().intValue());
                    mdcEquipmentShiftInfoMonth.setErrorLong(mdcEquipmentShiftStatisticalDto.getErrorLong().intValue());
                    mdcEquipmentShiftInfoMonth.setWaitLong(mdcEquipmentShiftStatisticalDto.getWaitLong().intValue());
                    mdcEquipmentShiftInfoMonth.setProcessLong(mdcEquipmentShiftStatisticalDto.getProcessLong().intValue());
                    mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    if (mdcEquipmentShiftStatisticalDto != null) {
                        mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong().intValue());
                        mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong().intValue());
                        mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong().intValue());
                        mdcEquipmentShiftInfoMonth.setErrorLong(mdcEquipmentShiftStatisticalDto.getErrorLong().intValue());
                        mdcEquipmentShiftInfoMonth.setWaitLong(mdcEquipmentShiftStatisticalDto.getWaitLong().intValue());
                        mdcEquipmentShiftInfoMonth.setProcessLong(mdcEquipmentShiftStatisticalDto.getProcessLong().intValue());
                        mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                        mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                        mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    }
                    mdcEquipmentStatisticalShiftInfoMonthList.add(mdcEquipmentShiftInfoMonth);
                    // step.4 æ±‡æ€»å„班次利用率数据
                    List<MdcEquipmentStatisticalDto> essdList = mdcEquipmentStatisticalShiftInfoService.findShiftByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date);
@@ -139,9 +147,9 @@
                            equipmentStatisticalShiftInfoMonth.setErrorLong(equipmentStatisticalDto.getErrorLong().intValue());
                            equipmentStatisticalShiftInfoMonth.setWaitLong(equipmentStatisticalDto.getWaitLong().intValue());
                            equipmentStatisticalShiftInfoMonth.setProcessLong(equipmentStatisticalDto.getProcessLong().intValue());
                            equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            mdcEquipmentStatisticalShiftInfoMonthList.add(equipmentStatisticalShiftInfoMonth);
                        }
                    }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentFaultInfoMapper.java
@@ -16,4 +16,7 @@
public interface MdcEquipmentFaultInfoMapper extends BaseMapper<MdcEquipmentFaultInfo> {
    List<EquFaultRecord> findFaultRecord(@Param("equipmentIdList") List<String> equipmentIdList, @Param("startTime") String startTime, @Param("endTime") String endTime);
    String getMaxStaticsData();
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java
@@ -81,4 +81,6 @@
    List<MdcEquipmentWaitSectionDto> findWaitList(@Param("date") String date);
    List<EquFaultRecord> findFaultList(@Param("equipmentId") String equipmentId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
    MdcEquipmentRunningSection getFirstRecord();
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -195,7 +195,8 @@
        SELECT
            t3.equipment_name,
            t1.utilization_rate AS utilizationRate,
            t2.utilization_rate AS shiftUtilizationRate
            t2.utilization_rate AS shiftUtilizationRate,
            t1.remove_fault_rate AS amendUtilizationRate
        FROM
            mdc_equipment_statistical_info_month t1
                LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month AND t2.shift_type = 1
@@ -215,7 +216,8 @@
        SELECT
            t3.team_code AS teamCode,
            t1.utilization_rate AS utilizationRate,
            t2.utilization_rate AS shiftUtilizationRate
            t2.utilization_rate AS shiftUtilizationRate,
            t1.remove_fault_rate AS amendUtilizationRate
        FROM
            mdc_equipment_statistical_info_month t1
                LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month AND t2.shift_type = 1
@@ -234,6 +236,7 @@
            t1.the_month AS theMonth,
            AVG ( t1.utilization_rate ) AS utilizationRate,
            AVG ( t2.utilization_rate ) AS shiftUtilizationRate,
            AVG ( t1.remove_fault_rate ) AS amendUtilizationRate,
            SUM ( t1.process_long ) AS processLong
        FROM
            mdc_equipment_statistical_info_month t1
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentFaultInfoMapper.xml
@@ -23,4 +23,8 @@
            </foreach>
          AND t1.report_status != 'ABOLISH'
    </select>
    <select id="getMaxStaticsData" resultType="java.lang.String">
        SELECT TOP 1 the_date FROM mdc_equipment_fault_info ORDER BY the_date DESC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml
@@ -207,5 +207,9 @@
          AND t1.report_status != 'ABOLISH'
    </select>
    <select id="getFirstRecord" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT TOP 1 * FROM mdc_equipment_running_section ORDER BY start_time
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml
@@ -15,16 +15,20 @@
    <select id="findByEquipmentAndMonth" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto">
        SELECT
            SUM(open_long) openLong,
            SUM(close_long) closeLong,
            SUM(wait_long) waitLong,
            SUM(process_long) processLong,
            SUM(error_long) errorLong,
            SUM ( t1.open_long ) openLong,
            SUM ( t1.close_long ) closeLong,
            SUM ( t1.wait_long ) waitLong,
            SUM ( t1.process_long ) processLong,
            SUM ( t1.error_long ) errorLong,
            SUM ( t2.fault_long ) faultLong,
            AVG ( t2.fault_rate ) faultRate,
            SUM ( t2.remove_fault_run_long ) removeFaultRunLong,
            AVG ( t2.remove_fault_rate ) removeFaultRate,
            COUNT(*) dayNum
        FROM
            mdc_equipment_statistical_info
            mdc_equipment_statistical_info t1 LEFT JOIN mdc_equipment_fault_info t2 ON t1.equipment_id = t2.equipment_id AND t1.the_date = t2.the_date
        WHERE
            equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%')
            t1.equipment_id = #{equipmentId} AND t1.the_date LIKE CONCAT(#{date}, '%')
    </select>
    <select id="findByEquIdsAndMonth" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java
@@ -90,4 +90,7 @@
    List<Integer> getDataList(String equipmentId, Date date);
    List<MdcEquipmentWaitSectionDto> findWaitList(String date);
    MdcEquipmentRunningSection getFirstRecord();
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentFaultInfoServiceImpl.java
@@ -48,12 +48,31 @@
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public void runningAllEquFaultStatistical(String dateTime) {
        String validDate = LocalDate.now().minusDays(1).toString().replaceAll("-", "");
        Date initDate = null;
        if (StringUtils.isNotBlank(dateTime)) {
            validDate = DateUtils.format(DateUtils.toDate(dateTime, DateUtils.STRDATE), DateUtils.STRDATE);
            initDate = DateUtils.toDate(dateTime, DateUtils.STRDATE);
        } else {
            // å–最后的统计时间
            String date = this.baseMapper.getMaxStaticsData();
            if (date != null) {
                initDate = DateUtils.toDate(date, DateUtils.STRDATE);
            } else {
                // åˆæ¬¡å–值 å–最早时间记录
                MdcEquipmentRunningSection equipmentRunningSection = mdcEquipmentRunningSectionService.getFirstRecord();
                if (equipmentRunningSection != null) {
                    initDate = equipmentRunningSection.getStartTime();
                }
            }
        }
        Date endDate = DateUtils.addDays(DateUtils.getNow(), -1);
        List<String> dateList = DateUtils.getDatesStringList2(initDate, endDate);
        if (dateList.isEmpty()) {
            return;
        }
        try {
            this.remove(new LambdaQueryWrapper<MdcEquipmentFaultInfo>().eq(MdcEquipmentFaultInfo::getTheDate, validDate));
            this.remove(new LambdaQueryWrapper<MdcEquipmentFaultInfo>().in(MdcEquipmentFaultInfo::getTheDate, dateList));
        } catch (Exception e) {
            log.error("参数格式不对", e);
        }
@@ -63,13 +82,6 @@
            return;
        }
        Map<String, MdcEquipmentFaultInfo> map = new HashMap<>();
        String finalValidDate = validDate;
        equipmentList.forEach(equipment -> {
            MdcEquipmentFaultInfo mdcEquipmentFaultInfo = new MdcEquipmentFaultInfo(equipment.getEquipmentid(), finalValidDate);
            map.put(equipment.getEquipmentid(), mdcEquipmentFaultInfo);
        });
        String planTime = "00:00:00";
        MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time"));
        if (mdcSystemParameters != null) {
@@ -77,56 +89,98 @@
        }
        List<String> equipmentIdList = equipmentList.stream().map(Equipment::getEquipmentid).collect(Collectors.toList());
        String startTime = DateUtils.format(DateUtils.setTimeForDay(DateUtils.toDate(validDate, DateUtils.STRDATE), planTime), DateUtils.STR_DATE_TIME_SMALL);
        Date start = DateUtils.toDate(startTime, DateUtils.STR_DATE_TIME_SMALL);
        String endTime = DateUtils.format(DateUtils.addDays(DateUtils.toDate(startTime, DateUtils.STR_DATE_TIME_SMALL), 1), DateUtils.STR_DATE_TIME_SMALL);
        Date end = DateUtils.toDate(endTime, DateUtils.STR_DATE_TIME_SMALL);
        //查询故障记录
        List<EquFaultRecord> equFaultRecordList = this.baseMapper.findFaultRecord(equipmentIdList, startTime, endTime);
        if (equFaultRecordList != null && !equFaultRecordList.isEmpty()) {
            // ä¿®æ•´æ—¶é—´
            Map<String, List<EquFaultRecord>> equFaultRecordMap = equFaultRecordList.stream().collect(Collectors.groupingBy(EquFaultRecord::getEquipmentId));
            equFaultRecordMap.forEach((key, value) -> {
                if (map.containsKey(key)) {
                    MdcEquipmentFaultInfo equFaultRecords = map.get(key);
                    long faultLong = calculateTotalFaultDuration(value, start, end);
                    equFaultRecords.setFaultLong((int) faultLong);
                    if (faultLong != 0) {
                        equFaultRecords.setFaultRate(new BigDecimal(faultLong).divide(new BigDecimal("86400"), 2, RoundingMode.HALF_UP));
                    }
                    // è®¡ç®—去除故障时长的加工时间
                    // step.1 æŸ¥è¯¢åŠ å·¥æ—¶é—´
                    List<MdcEquipmentRunningSection> mdcEquipmentRunningSections = mdcEquipmentRunningSectionService.selectRunningData(key, start, end);
                    if (mdcEquipmentRunningSections != null && !mdcEquipmentRunningSections.isEmpty()) {
                        // æ—¶é—´ä¿®æ­£
                        if (mdcEquipmentRunningSections.get(0).getStartTime().before(start)) {
                            mdcEquipmentRunningSections.get(0).setStartTime(start);
                        }
                        if (mdcEquipmentRunningSections.size() > 1) {
                            if (mdcEquipmentRunningSections.get(mdcEquipmentRunningSections.size() - 1).getEndTime().after(end)) {
                                mdcEquipmentRunningSections.get(mdcEquipmentRunningSections.size() - 1).setEndTime(end);
                            }
                        } else {
                            if (mdcEquipmentRunningSections.get(0).getEndTime().after(end)) {
                                mdcEquipmentRunningSections.get(0).setEndTime(end);
                            }
                        }
                        // step.2 è®¡ç®—去除故障时长的加工时间
                        long processingTime = calculateProcessingTimeWithoutFaults(mdcEquipmentRunningSections, value, start, end);
                        equFaultRecords.setRemoveFaultRunLong((int) processingTime);
        for (String validDate : dateList) {
            Map<String, MdcEquipmentFaultInfo> map = new HashMap<>();
            String finalValidDate = validDate;
            equipmentList.forEach(equipment -> {
                MdcEquipmentFaultInfo mdcEquipmentFaultInfo = new MdcEquipmentFaultInfo(equipment.getEquipmentid(), finalValidDate);
                map.put(equipment.getEquipmentid(), mdcEquipmentFaultInfo);
            });
            String startTime = DateUtils.format(DateUtils.setTimeForDay(DateUtils.toDate(validDate, DateUtils.STRDATE), planTime), DateUtils.STR_DATE_TIME_SMALL);
            Date start = DateUtils.toDate(startTime, DateUtils.STR_DATE_TIME_SMALL);
            String endTime = DateUtils.format(DateUtils.addDays(DateUtils.toDate(startTime, DateUtils.STR_DATE_TIME_SMALL), 1), DateUtils.STR_DATE_TIME_SMALL);
            Date end = DateUtils.toDate(endTime, DateUtils.STR_DATE_TIME_SMALL);
            //查询故障记录
            List<EquFaultRecord> equFaultRecordList = this.baseMapper.findFaultRecord(equipmentIdList, startTime, endTime);
            if (equFaultRecordList != null && !equFaultRecordList.isEmpty()) {
                // ä¿®æ•´æ—¶é—´
                Map<String, List<EquFaultRecord>> equFaultRecordMap = equFaultRecordList.stream().collect(Collectors.groupingBy(EquFaultRecord::getEquipmentId));
                map.forEach((key, value1) -> {
                    MdcEquipmentFaultInfo equFaultRecords = value1;
                    if (equFaultRecordMap.containsKey(key)) {
                        List<EquFaultRecord> value = equFaultRecordMap.get(key);
                        long faultLong = calculateTotalFaultDuration(value, start, end);
                        equFaultRecords.setFaultLong((int) faultLong);
                        if (faultLong != 0) {
                            // è®¡ç®—去除故障时长的利用率
                            BigDecimal removeFaultRate = new BigDecimal(processingTime).divide(new BigDecimal("86400").subtract(new BigDecimal(faultLong)), 2, RoundingMode.HALF_UP);
                            equFaultRecords.setRemoveFaultRate(removeFaultRate);
                            equFaultRecords.setFaultRate(new BigDecimal(faultLong).divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP));
                        }
                        // è®¡ç®—去除故障时长的加工时间
                        // step.1 æŸ¥è¯¢åŠ å·¥æ—¶é—´
                        List<MdcEquipmentRunningSection> mdcEquipmentRunningSections = mdcEquipmentRunningSectionService.listEquipmentRunningSectionRun(key, start.getTime(), end.getTime());
                        if (mdcEquipmentRunningSections != null && !mdcEquipmentRunningSections.isEmpty()) {
                            // æ—¶é—´ä¿®æ­£
                            if (mdcEquipmentRunningSections.get(0).getStartTime().before(start)) {
                                mdcEquipmentRunningSections.get(0).setStartTime(start);
                            }
                            if (mdcEquipmentRunningSections.size() > 1) {
                                if (mdcEquipmentRunningSections.get(mdcEquipmentRunningSections.size() - 1).getEndTime().after(end)) {
                                    mdcEquipmentRunningSections.get(mdcEquipmentRunningSections.size() - 1).setEndTime(end);
                                }
                            } else {
                                if (mdcEquipmentRunningSections.get(0).getEndTime().after(end)) {
                                    mdcEquipmentRunningSections.get(0).setEndTime(end);
                                }
                            }
                            List<MdcEquipmentRunningSection> collect = mdcEquipmentRunningSections.stream().filter(mdcEquipmentRunningSection -> mdcEquipmentRunningSection.getStatus() == 3).collect(Collectors.toList());
                            if (!collect.isEmpty()) {
                                // step.2 è®¡ç®—去除故障时长的加工时间
                                long processingTime = calculateProcessingTimeWithoutFaults(collect, value, start, end);
                                equFaultRecords.setRemoveFaultRunLong((int) processingTime);
                                if (faultLong != 0 && faultLong != 86400) {
                                    // è®¡ç®—去除故障时长的利用率
                                    BigDecimal removeFaultRate = new BigDecimal(processingTime).divide(new BigDecimal("864").subtract(new BigDecimal(faultLong)), 2, RoundingMode.HALF_UP);
                                    equFaultRecords.setRemoveFaultRate(removeFaultRate);
                                }
                            }
                        }
                    } else {
                        List<MdcEquipmentRunningSection> mdcEquipmentRunningSections = mdcEquipmentRunningSectionService.listEquipmentRunningSectionRun(key, start.getTime(), end.getTime());
                        if (mdcEquipmentRunningSections != null && !mdcEquipmentRunningSections.isEmpty()) {
                            // æ—¶é—´ä¿®æ­£
                            if (mdcEquipmentRunningSections.get(0).getStartTime().before(start)) {
                                mdcEquipmentRunningSections.get(0).setStartTime(start);
                            }
                            if (mdcEquipmentRunningSections.size() > 1) {
                                if (mdcEquipmentRunningSections.get(mdcEquipmentRunningSections.size() - 1).getEndTime().after(end)) {
                                    mdcEquipmentRunningSections.get(mdcEquipmentRunningSections.size() - 1).setEndTime(end);
                                }
                            } else {
                                if (mdcEquipmentRunningSections.get(0).getEndTime().after(end)) {
                                    mdcEquipmentRunningSections.get(0).setEndTime(end);
                                }
                            }
                            List<MdcEquipmentRunningSection> collect = mdcEquipmentRunningSections.stream().filter(mdcEquipmentRunningSection -> mdcEquipmentRunningSection.getStatus() == 3).collect(Collectors.toList());
                            if (!collect.isEmpty()) {
                                long totalProcessingTime = 0;
                                for (MdcEquipmentRunningSection mdcEquipmentRunningSection : collect) {
                                    totalProcessingTime += ChronoUnit.SECONDS.between(DateUtils.convertToLocalDateTime(mdcEquipmentRunningSection.getStartTime()), DateUtils.convertToLocalDateTime(mdcEquipmentRunningSection.getEndTime()));
                                }
                                equFaultRecords.setRemoveFaultRunLong((int) totalProcessingTime);
                                // è®¡ç®—去除故障时长的利用率
                                BigDecimal removeFaultRate = new BigDecimal(totalProcessingTime).divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP);
                                equFaultRecords.setRemoveFaultRate(removeFaultRate);
                            }
                        }
                    }
                    map.put(key, equFaultRecords);
                }
            });
        }
        if (!map.isEmpty()) {
            this.saveBatch(new ArrayList<>(map.values()));
                });
            }
            if (!map.isEmpty()) {
                this.saveBatch(new ArrayList<>(map.values()));
            }
        }
    }
@@ -215,13 +269,9 @@
        LocalDateTime start = DateUtils.convertToLocalDateTime(startTime);
        LocalDateTime end = DateUtils.convertToLocalDateTime(endTime);
        // å°†æ•…障记录转换为时间区间并合并重叠部分
//        List<TimeInterval> faultIntervals = faultRecords.stream()
//                .map(record -> new TimeInterval(
//                        convertToLocalDateTime(record.getStartTime()),
//                        convertToLocalDateTime(record.getEndTime())))
//                .collect(Collectors.toList());
        List<TimeInterval> mergedFaultIntervals = mergeIntervals(faultRecords);
        // ä¿®æ­£è®°å½•æ—¶é—´
        List<EquFaultRecord> correctedRecords = correctRecordTimes(faultRecords, start, end);
        List<TimeInterval> mergedFaultIntervals = mergeIntervals(correctedRecords);
        long totalProcessingTime = 0;
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
@@ -841,14 +841,22 @@
        return this.baseMapper.findWaitList(date);
    }
    @Override
    public MdcEquipmentRunningSection getFirstRecord() {
        return this.baseMapper.getFirstRecord();
    }
    private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) {
        Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>();
        List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>();
        List<MdcEquipmentRunningSectionDto> waring = new ArrayList<>();
        List<MdcEquipmentRunningSectionDto> fault = new ArrayList<>();
        //运行
        List<MdcEquipmentRunningSection> running = loadEquipmentRunningTrace(equipmentRunningSectionVo.getEquipmentId(), date);
        //报警
        List<MdcEquipmentRunningSection> errs = loadEquipmentErrorTrace(equipmentRunningSectionVo.getEquipmentId(), date);
        //故障
        List<MdcEquipmentRunningSection> faults = loadEquipmentFaultTrace(equipmentRunningSectionVo.getEquipmentId(), date);
        if (running != null && !running.isEmpty()) {
            MdcEquipmentRunningSectionDto dto;
@@ -872,8 +880,20 @@
            map.put("waring", null);
        }
        if (!faults.isEmpty()) {
            MdcEquipmentRunningSectionDto dto;
            for (MdcEquipmentRunningSection mdcEquipmentRunningSection : faults) {
                dto = new MdcEquipmentRunningSectionDto();
                BeanUtils.copyProperties(mdcEquipmentRunningSection, dto);
                fault.add(dto);
            }
        } else {
            map.put("fault", null);
        }
        map.put("normal", normal);
        map.put("waring", waring);
        map.put("fault", fault);
        return map;
    }
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/InboundOrderController.java
@@ -252,17 +252,17 @@
     @AutoLog(value = "工具入库-新增入库")
     @ApiOperation(value = "工具入库-新增入库", notes = "工具入库-新增入库")
     @PostMapping("/addInStorage")
     public Result<?> addInStorage(@RequestBody JSONObject jSONObject) {
        inboundOrderService.addInStorage(jSONObject);
        return Result.OK("操作成功");
     public Result<List<Map<String,String>>> addInStorage(@RequestBody JSONObject jSONObject) {
         List<Map<String,String>> result  = inboundOrderService.addInStorage(jSONObject);
        return Result.OK(result);
     }
     @AutoLog(value = "工具入库-申请单入库")
     @ApiOperation(value = "工具入库-申请单入库", notes = "工具入库-申请单入库")
     @PostMapping("/addApplyInStorage")
     public Result<?> addApplyInStorage(@RequestBody JSONObject jSONObject) {
         inboundOrderService.addApplyInStorage(jSONObject);
         return Result.OK("操作成功");
     public Result<List<Map<String,String>>> addApplyInStorage(@RequestBody JSONObject jSONObject) {
         List<Map<String,String>> result  = inboundOrderService.addApplyInStorage(jSONObject);
         return Result.OK(result);
     }
}
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IInboundOrderService.java
@@ -6,6 +6,9 @@
import org.jeecg.modules.tms.entity.dto.InboundOrderFlowDto;
import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto;
import java.util.List;
import java.util.Map;
/**
 * @Description: å…¥åº“申请单
 * @Author: jeecg-boot
@@ -18,7 +21,7 @@
    void approvalProcess(InboundOrderFlowDto inboundOrderFlowDto);
    void addInStorage(JSONObject jSONObject);
    List<Map<String,String>> addInStorage(JSONObject jSONObject);
    void addApplyInStorage(JSONObject jSONObject);
    List<Map<String,String>> addApplyInStorage(JSONObject jSONObject);
}
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/InboundOrderServiceImpl.java
@@ -24,6 +24,7 @@
import org.jeecg.modules.tms.entity.vo.InboundDetailVo;
import org.jeecg.modules.tms.mapper.InboundOrderMapper;
import org.jeecg.modules.tms.service.*;
import org.jeecg.modules.tms.utils.QrCodePrinterUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -216,9 +217,12 @@
    }
    @Override
    public void addInStorage(JSONObject jSONObject) {
    public List<Map<String,String>> addInStorage(JSONObject jSONObject) {
        String inStorehouseType = jSONObject.getString("inStorehouseType");
        String locationCodeId = jSONObject.getString("locationCodeId");
        //二维码打印列表
        List<Map<String,String>> results = new ArrayList<>();
        List<String> contentList = new ArrayList<>();
        String classifyId = jSONObject.getString("classifyId");
        Date inboundTime = jSONObject.getDate("inboundTime");
        //获取入库明细
@@ -276,6 +280,7 @@
                        //增加库存明细
                        ToolLedgerDetail toolLedgerDetail = new ToolLedgerDetail();
                        toolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId());
                        toolLedgerDetail.setPositionCode(locationCodeId);
                        toolLedgerDetail.setToolId(inboundDetailVo.getToolCode()+"-"+result);
                        toolLedgerDetail.setQuantity(BigDecimal.ONE);
                        toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE);
@@ -284,7 +289,20 @@
                        //更新当前编码
                        newBaseTools.setCurrentCode(result);
                        baseToolsService.updateById(newBaseTools);
                        //打印二维码
                        contentList.add(inboundDetailVo.getToolCode()+"-"+result);
                    }
                    //打印二维码,暂时注释,待现场调试打标机
//                    for(String content : contentList){
//                        Map<String,String> result = new HashMap<>();
//                        result.put("content",content);
//                        result.put("image", QrCodePrinterUtils.generateBacthQRCode(content, 200, 200));
//                        // ç”ŸæˆäºŒç»´ç å›¾ç‰‡ï¼ˆBase64)
//                        results.add(result);
//                    }
                    Map<String,String> result = new HashMap<>();
                    result.put("content","保存成功");
                    results.add(result);
                    //不管到把
                }else {
                    //保存入库流水
@@ -302,12 +320,17 @@
                        ToolLedgerDetail newToolLedgerDetail = new ToolLedgerDetail();
                        newToolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId());
                        newToolLedgerDetail.setQuantity(inboundDetailVo.getInStorageQuantity());
                        newToolLedgerDetail.setPositionCode(locationCodeId);
                        newToolLedgerDetail.setStatus("1");
                        toolLedgerDetailService.save(newToolLedgerDetail);
                    }else {
                        toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity()));
                        toolLedgerDetail.setPositionCode(locationCodeId);
                        toolLedgerDetailService.updateById(toolLedgerDetail);
                    }
                    Map<String,String> result = new HashMap<>();
                    result.put("content","保存成功");
                    results.add(result);
                }
            }
            //归还入库
@@ -330,6 +353,7 @@
                            .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one();
                    toolLedgerDetail.setQuantity(BigDecimal.ONE);
                    toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE);
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
@@ -347,6 +371,7 @@
                    //增加库存明细可用库存,修改状态
                    ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one();
                    toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity()));
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
@@ -361,6 +386,9 @@
                }
            }
            Map<String,String> result = new HashMap<>();
            result.put("content","保存成功");
            results.add(result);
        }else if("5".equals(inStorehouseType)){
            //循环新增明细
            for(InboundDetailVo inboundDetailVo : inStoreDetailList) {
@@ -380,6 +408,7 @@
                            .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one();
                    toolLedgerDetail.setQuantity(BigDecimal.ONE);
                    toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE);
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
@@ -397,6 +426,7 @@
                    //增加库存明细可用库存,修改状态
                    ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one();
                    toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity()));
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
@@ -411,13 +441,20 @@
                }
            }
            Map<String,String> result = new HashMap<>();
            result.put("content","保存成功");
            results.add(result);
        }
        return results;
    }
    @Override
    public void addApplyInStorage(JSONObject jSONObject) {
    public List<Map<String,String>> addApplyInStorage(JSONObject jSONObject) {
        String inStorehouseType = jSONObject.getString("inStorehouseType");
        String locationCodeId = jSONObject.getString("locationCodeId");
        //二维码打印列表
        List<Map<String,String>> results = new ArrayList<>();
        List<String> contentList = new ArrayList<>();
        //入库申请单id
        String orderId = jSONObject.getString("orderId");
        //获取入库明细
@@ -478,12 +515,26 @@
                        toolLedgerDetail.setToolId(inboundDetailVo.getToolCode()+"-"+result);
                        toolLedgerDetail.setQuantity(BigDecimal.ONE);
                        toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE);
                        toolLedgerDetail.setPositionCode(locationCodeId);
                        toolLedgerDetail.setStatus("1");
                        toolLedgerDetailService.save(toolLedgerDetail);
                        //更新当前编码
                        newBaseTools.setCurrentCode(result);
                        baseToolsService.updateById(newBaseTools);
                        //打印二维码
                        contentList.add(inboundDetailVo.getToolCode()+"-"+result);
                    }
                    //打印二维码,暂时注释,待现场验证打标机
//                    for(String content : contentList){
//                        Map<String,String> result = new HashMap<>();
//                        result.put("content",content);
//                        result.put("image", QrCodePrinterUtils.generateBacthQRCode(content, 200, 200));
//                        // ç”ŸæˆäºŒç»´ç å›¾ç‰‡ï¼ˆBase64)
//                        results.add(result);
//                    }
                    Map<String,String> result = new HashMap<>();
                    result.put("content","保存成功");
                    results.add(result);
                    //不管到把
                }else {
                    //保存入库流水
@@ -502,12 +553,17 @@
                        ToolLedgerDetail newToolLedgerDetail = new ToolLedgerDetail();
                        newToolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId());
                        newToolLedgerDetail.setQuantity(inboundDetailVo.getInStorageQuantity());
                        newToolLedgerDetail.setPositionCode(locationCodeId);
                        newToolLedgerDetail.setStatus("1");
                        toolLedgerDetailService.save(newToolLedgerDetail);
                    }else {
                        toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity()));
                        toolLedgerDetail.setPositionCode(locationCodeId);
                        toolLedgerDetailService.updateById(toolLedgerDetail);
                    }
                    Map<String,String> result = new HashMap<>();
                    result.put("content","保存成功");
                    results.add(result);
                }
                //更改明细入库状态及实际入库数量
                InboundDetail inboundDetail = inboundDetailService.getById(inboundDetailVo.getId());
@@ -535,6 +591,7 @@
                            .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one();
                    toolLedgerDetail.setQuantity(BigDecimal.ONE);
                    toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE);
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
@@ -554,6 +611,7 @@
                    ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one();
                    toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity()));
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
                    InStoreDetail inStoreDetail = new InStoreDetail();
@@ -572,6 +630,9 @@
                inboundDetail.setInActualCount(inboundDetailVo.getInStorageQuantity());
                inboundDetailService.updateById(inboundDetail);
            }
            Map<String,String> result = new HashMap<>();
            result.put("content","保存成功");
            results.add(result);
        }else if("5".equals(inStorehouseType)){
            //循环新增明细
            for(InboundDetailVo inboundDetailVo : inStoreDetailList) {
@@ -591,6 +652,7 @@
                            .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one();
                    toolLedgerDetail.setQuantity(BigDecimal.ONE);
                    toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE);
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
@@ -610,6 +672,7 @@
                    ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one();
                    toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity()));
                    toolLedgerDetail.setStatus("1");
                    toolLedgerDetail.setPositionCode(locationCodeId);
                    toolLedgerDetailService.updateById(toolLedgerDetail);
                    //保存入库流水
                    InStoreDetail inStoreDetail = new InStoreDetail();
@@ -628,6 +691,9 @@
                inboundDetail.setInActualCount(inboundDetailVo.getInStorageQuantity());
                inboundDetailService.updateById(inboundDetail);
            }
            Map<String,String> result = new HashMap<>();
            result.put("content","保存成功");
            results.add(result);
        }
        //更改申请单入库状态
        InboundOrder inboundOrder = this.getById(orderId);
@@ -639,6 +705,7 @@
            inboundOrder.setInStatus("2");
        }
        this.updateById(inboundOrder);
        return results;
    }
    private LoginUser getCurrentUser() {
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutboundOrderServiceImpl.java
@@ -388,9 +388,9 @@
        Map<String, BigDecimal> outBoundRequestMap = outBoundRequestList.stream()
                .collect(Collectors.toMap(OutBoundRequestDto::getOutboundDetailId, OutBoundRequestDto::getOutboundQuantity));
        Map<String, BigDecimal> ratedLifeMap = outBoundRequestList.stream()
                .collect(Collectors.toMap(OutBoundRequestDto::getOutboundDetailId, dto->dto.getRatedLife() != null ? dto.getRatedLife() : null));
                .collect(Collectors.toMap(OutBoundRequestDto::getOutboundDetailId, dto->dto.getRatedLife() != null ? dto.getRatedLife() : BigDecimal.ZERO));
        Map<String, BigDecimal> useLifeMap = outBoundRequestList.stream()
                .collect(Collectors.toMap(OutBoundRequestDto::getOutboundDetailId, dto->dto.getUseLife() != null ? dto.getUseLife() : null));
                .collect(Collectors.toMap(OutBoundRequestDto::getOutboundDetailId, dto->dto.getUseLife() != null ? dto.getUseLife() : BigDecimal.ZERO));
        //处理库存台账及台账明细
        Map<String, ToolLedger> toolLedgerMap = toolLedgerService.list(new LambdaQueryWrapper<ToolLedger>().in(ToolLedger::getToolId, toolIdList)).stream()
                .collect(Collectors.toMap(ToolLedger::getToolId, item -> item, (k1, k2) -> k1));
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/utils/QrCodePrinterUtils.java
@@ -1,74 +1,92 @@
package org.jeecg.modules.tms.utils;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import liquibase.pro.packaged.S;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import java.awt.print.*;
import java.awt.image.BufferedImage;
import java.awt.*;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.util.*;
public class QrCodePrinterUtils implements Printable {
@RestController
@RequestMapping("/tms/qyCode")
@Slf4j
public class QrCodePrinterUtils{
    private final BufferedImage image;
    @GetMapping("/generate")
    public Result<Map<String, String>> generateQrCode() throws Exception {
        String content = "Q201204330002-0001";
        // ç”ŸæˆäºŒç»´ç å›¾ç‰‡ï¼ˆBase64)
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        generateQRCodeImage(content, 200, 200, os);
        String base64Img = "data:image/png;base64," + Base64.getEncoder().encodeToString(os.toByteArray());
    public QrCodePrinterUtils(BufferedImage image) {
        this.image = image;
        // è¿”回结果
        Map<String, String> result = new HashMap<>();
        result.put("image", base64Img);
        result.put("content", content);
        return Result.OK(result);
    }
    /**
     * æ‰“印二维码
     */
    public void print() {
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable(this);
        // å¼¹å‡ºæ‰“印对话框(可选)
        if (job.printDialog()) {
            try {
                job.print();
            } catch (PrinterException e) {
                System.err.println("打印失败: " + e.getMessage());
            }
        }
    public static void generateQRCodeImage(String text, int width, int height, OutputStream os) throws Exception {
        QRCodeWriter qrCodeWriter = new QRCodeWriter();
        BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height);
        MatrixToImageWriter.writeToStream(bitMatrix, "PNG", os);
    }
    /**
     * å®žçް Printable æŽ¥å£çš„æ‰“印方法
     */
    @Override
    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
        if (pageIndex > 0) {
            return NO_SUCH_PAGE;
        }
        Graphics2D g2d = (Graphics2D) graphics;
        g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
        // è®¡ç®—居中坐标
        double pageWidth = pageFormat.getImageableWidth();
        double pageHeight = pageFormat.getImageableHeight();
        double imgWidth = image.getWidth();
        double imgHeight = image.getHeight();
        double scale = Math.min(pageWidth / imgWidth, pageHeight / imgHeight);
        g2d.scale(scale, scale);
        g2d.drawImage(image, 0, 0, null);
        return PAGE_EXISTS;
    }
    /**
     * ä½¿ç”¨é»˜è®¤æ‰“印机打印,不弹对话框
     */
    public static void noDialogPrint(){
        BufferedImage qrImage = QrCodeUtils.generateQrCode("Silent Print", 300, 300);
        QrCodePrinterUtils printer = new QrCodePrinterUtils(qrImage);
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable(printer);
    public static String generateBacthQRCode(String content, int width, int height) {
        try {
            job.print();
        } catch (PrinterException e) {
            e.printStackTrace();
            Map<EncodeHintType, Object> hints = new HashMap<>();
            hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
            hints.put(EncodeHintType.MARGIN, 1);
            BitMatrix matrix = new MultiFormatWriter().encode(
                    content,
                    BarcodeFormat.QR_CODE,
                    width,
                    height,
                    hints
            );
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            MatrixToImageWriter.writeToStream(matrix, "PNG", os);
            return "data:image/png;base64," +
                    Base64.getEncoder().encodeToString(os.toByteArray());
        } catch (Exception e) {
            throw new RuntimeException("生成二维码失败", e);
        }
    }
    @GetMapping("/batchGenerate")
    public Result<List<Map<String,String>>> generateBatchQrCode(){
        List<Map<String,String>> results = new ArrayList<>();
        List<String> contentList = new ArrayList<>();
        contentList.add("Q201204330002-0001");
        contentList.add("Q201204330002-0002");
        contentList.add("Q201204330002-0003");
        for(String content : contentList){
            Map<String,String> result = new HashMap<>();
            result.put("content",content);
            result.put("image",generateBacthQRCode(content, 200, 200));
            // ç”ŸæˆäºŒç»´ç å›¾ç‰‡ï¼ˆBase64)
            results.add(result);
        }
        return Result.OK(results);
    }
}