Merge remote-tracking branch 'origin/master'
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | 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: ç¹æ£å·¥å |
| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | 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: 设å¤äºçº§ä¿å
»æç» |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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: 设å¤ä¸çº§ä¿å
»æç» |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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: ç¹æ£å·¥å |
| | |
| | | * @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); |
| | | } |
| | |
| | | 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> |
| | |
| | | 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: ç¹æ£å·¥å |
| | |
| | | * @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); |
| | | } |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | */ |
| | | 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; |
| | |
| | | @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) |
| | |
| | | @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") |
| | |
| | | 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)); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | public interface MdcEquipmentFaultInfoMapper extends BaseMapper<MdcEquipmentFaultInfo> { |
| | | |
| | | List<EquFaultRecord> findFaultRecord(@Param("equipmentIdList") List<String> equipmentIdList, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | String getMaxStaticsData(); |
| | | |
| | | } |
| | |
| | | List<MdcEquipmentWaitSectionDto> findWaitList(@Param("date") String date); |
| | | |
| | | List<EquFaultRecord> findFaultList(@Param("equipmentId") String equipmentId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); |
| | | |
| | | MdcEquipmentRunningSection getFirstRecord(); |
| | | } |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | </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> |
| | |
| | | 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> |
| | |
| | | |
| | | <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"> |
| | |
| | | List<Integer> getDataList(String equipmentId, Date date); |
| | | |
| | | List<MdcEquipmentWaitSectionDto> findWaitList(String date); |
| | | |
| | | MdcEquipmentRunningSection getFirstRecord(); |
| | | |
| | | } |
| | |
| | | @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); |
| | | } |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | 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())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | @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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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 |
| | |
| | | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | } |
| | | |
| | | @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"); |
| | | //è·åå
¥åºæç» |
| | |
| | | //å¢å åºåæç» |
| | | ToolLedgerDetail toolLedgerDetail = new ToolLedgerDetail(); |
| | | toolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId()); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setToolId(inboundDetailVo.getToolCode()+"-"+result); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | |
| | | //æ´æ°å½åç¼ç |
| | | 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 { |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | 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); |
| | | } |
| | | } |
| | | //å½è¿å
¥åº |
| | |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | //å¢å åºåæç»å¯ç¨åºåï¼ä¿®æ¹ç¶æ |
| | | 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); |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | } |
| | | |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","ä¿åæå"); |
| | | results.add(result); |
| | | }else if("5".equals(inStorehouseType)){ |
| | | //å¾ªç¯æ°å¢æç» |
| | | for(InboundDetailVo inboundDetailVo : inStoreDetailList) { |
| | |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | //å¢å åºåæç»å¯ç¨åºåï¼ä¿®æ¹ç¶æ |
| | | 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); |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | } |
| | | |
| | | } |
| | | 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"); |
| | | //è·åå
¥åºæç» |
| | |
| | | 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 { |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | 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()); |
| | |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | 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(); |
| | |
| | | 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) { |
| | |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //ä¿åå
¥åºæµæ°´ |
| | |
| | | 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(); |
| | |
| | | inboundDetail.setInActualCount(inboundDetailVo.getInStorageQuantity()); |
| | | inboundDetailService.updateById(inboundDetail); |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","ä¿åæå"); |
| | | results.add(result); |
| | | } |
| | | //æ´æ¹ç³è¯·åå
¥åºç¶æ |
| | | InboundOrder inboundOrder = this.getById(orderId); |
| | |
| | | inboundOrder.setInStatus("2"); |
| | | } |
| | | this.updateById(inboundOrder); |
| | | return results; |
| | | } |
| | | |
| | | private LoginUser getCurrentUser() { |
| | |
| | | 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)); |
| | |
| | | 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); |
| | | } |
| | | } |