春风项目四线(合箱线、总装线)
wujian
5 天以前 ea3c33c8561df39d4f123d1424fda99dd0f0c51d
jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java
@@ -1,6 +1,7 @@
package com.jcdm.main.bs.orderScheduling.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
@@ -17,12 +18,12 @@
import com.jcdm.common.exception.ServiceException;
import com.jcdm.common.utils.StringUtils;
import com.jcdm.common.utils.poi.ExcelUtil;
import com.jcdm.main.bs.orderScheduling.Query.EngineQuery;
import com.jcdm.main.bs.orderScheduling.Query.SAPQuery;
import com.jcdm.main.bs.orderScheduling.common.Constants;
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
import com.jcdm.main.bs.orderScheduling.vo.FollowReportVO;
import com.jcdm.main.bs.orderScheduling.vo.LineChartVO;
import com.jcdm.main.bs.orderScheduling.vo.SumDataVO;
import com.jcdm.main.bs.orderScheduling.vo.*;
import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper;
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
@@ -43,6 +44,7 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@@ -156,9 +158,9 @@
            WriteSheet sheet1 = EasyExcel.writerSheet(1, "拧紧数据")
                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                    .build();
            WriteSheet sheet2 = EasyExcel.writerSheet(2, "相机检测")
                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                    .build();
//            WriteSheet sheet2 = EasyExcel.writerSheet(2, "相机检测")
//                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
//                    .build();
            WriteSheet sheet3 = EasyExcel.writerSheet(3, "外漏检测")
                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                    .build();
@@ -170,7 +172,7 @@
                    .build();
            excelWriter.write(followReportList.getMainList(),mainSheet);
            excelWriter.write(followReportList.getList1(),sheet1);
            excelWriter.write(followReportList.getList2(),sheet2);
//            excelWriter.write(followReportList.getList2(),sheet2);
            excelWriter.write(followReportList.getList3(),sheet3);
            excelWriter.write(followReportList.getList4(),sheet4);
            excelWriter.write(followReportList.getList5(),sheet5);
@@ -186,7 +188,6 @@
    /**
     * 查询下线数量
     */
    @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')")
    @GetMapping("/getOffLineNum")
    public TableDataInfo getOffLineNum(BsOrderScheduling bsOrderScheduling)
    {
@@ -217,11 +218,20 @@
            list = bsOrderSchedulingService.selectBsOrderSchedulingPage(bsOrderScheduling);
            if (CollUtil.isNotEmpty(list)){
                total = new PageInfo(list).getTotal();
                List<String> allEngineNoList = list.stream().map(BsOrderScheduling::getEngineNo).collect(Collectors.toList());
                List<ProductNewPassStation> productPassStationListByEngineList = productNewPassStationService.getProductPassStationListByEngineList(allEngineNoList);
                list.forEach(x -> {
                    if (StrUtil.isNotBlank(x.getWorkingHours())){
                        x.setWorkingHoursInt(Integer.parseInt(x.getWorkingHours()));
                    } else {
                        x.setWorkingHoursInt(0);
                    }
                    if (CollUtil.isNotEmpty(productPassStationListByEngineList)){
                        List<ProductNewPassStation> collect = productPassStationListByEngineList.stream().filter(y -> x.getEngineNo().equals(y.getSfcCode())).collect(Collectors.toList());
                        if (CollUtil.isNotEmpty(collect)){
                            ProductNewPassStation productNewPassStation = collect.get(0);
                            x.setBoxCode(productNewPassStation.getBoxCode());
                        }
                    }
                });
                list = list.stream().sorted(Comparator.comparing(BsOrderScheduling::getWorkingHoursInt)).collect(Collectors.toList());
@@ -461,10 +471,76 @@
                OrderScheduling.setProductionStatus("2");
                bsOrderSchedulingService.updateBsOrderScheduling(OrderScheduling);
                return R.ok();
            } else {
                return R.fail(500,"超出计划数量,请检查后重试");
            }
        }
        return R.ok();
    }
    @GetMapping("/changeBoxCode")
    public R changeBoxCode(String sfcCode,String newBoxCode){
        if (StringUtils.isEmpty(newBoxCode)){
            return R.fail(500,"箱体码不能为空,请重试");
        }
        if (StringUtils.isEmpty(sfcCode)){
            return R.fail(500,"发动机号不能为空,请重试");
        }
        if (!newBoxCode.contains(",")){
            return R.fail(500,"箱体码格式有误,请重试");
        }
        ProductNewPassStation checkStation = new ProductNewPassStation();
        checkStation.setSfcCode(sfcCode);
        List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(checkStation);
        if (CollUtil.isNotEmpty(productPassStationList)){
            productNewPassStationService.updateBoxCodeBySfcCode(sfcCode, newBoxCode);
            return R.ok();
        } else {
            return R.fail("未查找到该发动机号对应的箱体");
        }
    }
    @PostMapping("/engine-report")
    public ReportVO getReportDetail(@RequestBody SAPQuery sapQuery){
        ReportVO reportVO = new ReportVO();
        List<ResultDataVO> EV_DATA = new ArrayList<>();
        List<EngineQuery> engineQueryList = sapQuery.getIV_ZFDJM();
        if (CollUtil.isEmpty(engineQueryList)){
            reportVO.setEV_DATA(EV_DATA);
            return reportVO;
        }
        BsOrderScheduling query = new BsOrderScheduling();
        List<String> engineNoList = engineQueryList.stream().map(EngineQuery::getZFDJM).collect(Collectors.toList());
        query.setEngineNoList(engineNoList);
        List<BsOrderScheduling> bsOrderSchedulingList = bsOrderSchedulingService.selectBsOrderSchedulingList(query);
        for (String s : engineNoList) {
            ResultDataVO  resultDataVO = new ResultDataVO();
            resultDataVO.setZFDJM(s);
            List<BsOrderScheduling> collect = bsOrderSchedulingList.stream().filter(x -> x.getEngineNo().equals(s)).collect(Collectors.toList());
            if (CollUtil.isNotEmpty(collect)){
                BsOrderScheduling bsOrderScheduling = collect.get(0);
                if (StrUtil.isBlank(bsOrderScheduling.getReport20())){
                    resultDataVO.setSTATU("0");
                    resultDataVO.setEV_MESSAGE("未报工");
                } else {
                    if ("1".equals(bsOrderScheduling.getReport20())){
                        resultDataVO.setSTATU("1");
                        resultDataVO.setEV_MESSAGE("已报工");
                    } else if ("3".equals(bsOrderScheduling.getReport20())){
                        resultDataVO.setSTATU("2");
                        resultDataVO.setEV_MESSAGE(bsOrderScheduling.getRemarks());
                    }
                }
            } else {
                resultDataVO.setSTATU("2");
                resultDataVO.setEV_MESSAGE("未查询到此发动机信息");
            }
            EV_DATA.add(resultDataVO);
        }
        reportVO.setEV_DATA(EV_DATA);
        return reportVO;
    }
}