From ea3c33c8561df39d4f123d1424fda99dd0f0c51d Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期四, 14 十一月 2024 08:15:41 +0800
Subject: [PATCH] add - panel

---
 jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java |  461 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 444 insertions(+), 17 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java b/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java
index b65b7ee..3723ce2 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java
@@ -1,28 +1,56 @@
 package com.jcdm.main.bs.orderScheduling.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
-import com.jcdm.common.utils.StringUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+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;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.github.pagehelper.PageInfo;
 import com.jcdm.common.annotation.Log;
 import com.jcdm.common.core.controller.BaseController;
 import com.jcdm.common.core.domain.AjaxResult;
+import com.jcdm.common.core.domain.R;
+import com.jcdm.common.core.domain.entity.SysDictData;
+import com.jcdm.common.core.page.TableDataInfo;
 import com.jcdm.common.enums.BusinessType;
+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.common.utils.poi.ExcelUtil;
-import com.jcdm.common.core.page.TableDataInfo;
+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;
+import com.jcdm.main.da.passingStationCollection.domain.ProductNewPassStation;
+import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
+import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService;
+import com.jcdm.main.da.tileMatchCollection.domain.DaTileMatchCollection;
+import com.jcdm.main.da.tileMatchCollection.service.IDaTileMatchCollectionService;
+import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
+import com.jcdm.main.om.productionOrde.service.impl.OmProductionOrdeInfoServiceImpl;
+import com.jcdm.main.plcserver.conf.OPCElement;
+import com.jcdm.main.plcserver.sub.OPCUaSubscription;
+import com.jcdm.system.service.ISysDictDataService;
+import com.kangaroohy.milo.model.ReadWriteEntity;
+import com.kangaroohy.milo.service.MiloService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+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;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 璁㈠崟鎺掍骇Controller
@@ -37,6 +65,40 @@
     @Autowired
     private IBsOrderSchedulingService bsOrderSchedulingService;
 
+
+    @Resource
+    private ISysDictDataService iSysDictDataService;
+
+    @Resource
+    private OmProductionOrdeInfoServiceImpl productionOrdeInfoService;
+    @Resource
+    private DaParamCollectionMapper daParamCollectionService;
+    @Resource
+    private IDaTileMatchCollectionService daTileMatchCollectionService;
+    @Resource
+    private ProductNewPassStationService productNewPassStationService;
+
+    @Resource
+    private IDaPassingStationCollectionService daPassingStationCollectionService;
+
+    @Autowired
+    MiloService miloService;
+
+    @Value("${websocketUrl}")
+    private String websocketUrl;
+
+    @GetMapping("/forceUpload")
+    public void forceUpload() throws Exception {
+        ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP121_ZZ_CODE_CHECK, 1);
+        miloService.writeToOpcByte(entity);
+    }
+
+    @GetMapping("/websocketUrl")
+    public String websocketName() {
+        return websocketUrl;
+    }
+
+
     /**
      * 鏌ヨ璁㈠崟鎺掍骇鍒楄〃
      */
@@ -49,6 +111,91 @@
         return getDataTable(list);
     }
 
+    /**
+     * 鏌ヨ杩芥函鍒楄〃
+     */
+    @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')")
+    @GetMapping("/getFollowReportList")
+    public R getFollowReportList(BsOrderScheduling bsOrderScheduling)
+    {
+        FollowReportVO followReportList = bsOrderSchedulingService.getFollowReportList(bsOrderScheduling);
+        return R.ok(followReportList);
+    }
+
+    @PreAuthorize("@ss.hasPermi('bs:orderScheduling:export')")
+    @Log(title = "杩芥函鎶ヨ〃瀵煎嚭", businessType = BusinessType.EXPORT)
+    @PostMapping("/exportFollow")
+    public void exportFollow(HttpServletResponse response, BsOrderScheduling bsOrderScheduling)
+    {
+        FollowReportVO followReportList = bsOrderSchedulingService.getFollowReportList(bsOrderScheduling);
+        List<SysDictData> allDict = iSysDictDataService.selectDictDataList(null);
+        if (CollUtil.isNotEmpty(followReportList.getMainList())){
+            List<SysDictData> dict1 = allDict.stream().filter(x -> "material_type".equals(x.getDictType())).collect(Collectors.toList());
+            List<SysDictData> dict2 = allDict.stream().filter(x -> "order_scheduling_produce_status".equals(x.getDictType())).collect(Collectors.toList());
+            for (BsOrderScheduling orderScheduling : followReportList.getMainList()) {
+                if (CollUtil.isNotEmpty(dict1)){
+                    List<SysDictData> collect = dict1.stream().filter(x -> x.getDictValue().equals(orderScheduling.getProductType())).collect(Collectors.toList());
+                    if (CollUtil.isNotEmpty(collect)){
+                        SysDictData sysDictData1 = collect.get(0);
+                        orderScheduling.setProductTypeString(sysDictData1.getDictLabel());
+                    }
+                }
+                if (CollUtil.isNotEmpty(dict2)){
+                    List<SysDictData> collect = dict2.stream().filter(x -> x.getDictValue().equals(orderScheduling.getProductionStatus())).collect(Collectors.toList());
+                    if (CollUtil.isNotEmpty(collect)){
+                        SysDictData sysDictData1 = collect.get(0);
+                        orderScheduling.setProductionStatusString(sysDictData1.getDictLabel());
+                    }
+                }
+            }
+        }
+        String fileName = "杩芥函鎶ヨ〃";
+        try {
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build();
+            WriteSheet mainSheet = EasyExcel.writerSheet(0, "璁㈠崟鎺掍骇")
+                    .head(BsOrderScheduling.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            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 sheet3 = EasyExcel.writerSheet(3, "澶栨紡妫�娴�")
+                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            WriteSheet sheet4 = EasyExcel.writerSheet(4, "鏈烘补鍔犳敞")
+                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            WriteSheet sheet5 = EasyExcel.writerSheet(5, "宸ヤ綅缁撴灉")
+                    .head(DaPassingStationCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            excelWriter.write(followReportList.getMainList(),mainSheet);
+            excelWriter.write(followReportList.getList1(),sheet1);
+//            excelWriter.write(followReportList.getList2(),sheet2);
+            excelWriter.write(followReportList.getList3(),sheet3);
+            excelWriter.write(followReportList.getList4(),sheet4);
+            excelWriter.write(followReportList.getList5(),sheet5);
+            response.setContentType("application/vnd.ms-excel;charset=utf-8");
+            response.setCharacterEncoding("UTF-8");
+            response.setHeader("Content-Disposition","attachment;filename="+fileName+".xlsx");
+            excelWriter.finish();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 鏌ヨ涓嬬嚎鏁伴噺
+     */
+    @GetMapping("/getOffLineNum")
+    public TableDataInfo getOffLineNum(BsOrderScheduling bsOrderScheduling)
+    {
+
+        List<LineChartVO> vo = bsOrderSchedulingService.getOffLineNum();
+        return getDataTable(vo);
+    }
+
     @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')")
     @GetMapping("/list2")
     public TableDataInfo list2(BsOrderScheduling bsOrderScheduling)
@@ -59,6 +206,45 @@
             list = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
         }
         return getDataTable(list);
+    }
+
+    @GetMapping("/list3")
+    public TableDataInfo list3(BsOrderScheduling bsOrderScheduling)
+    {
+        startPage();
+        List<BsOrderScheduling> list = new ArrayList<>();
+        long total = 0;
+        if (StringUtils.isNotEmpty(bsOrderScheduling.getOrderNo())){
+            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());
+            }
+        }
+//        List<BsOrderScheduling> collect = list.stream().filter(x -> Constants.UN_QUALIFIED.equals(x.getQualityStatus())).collect(Collectors.toList());
+//        if (CollUtil.isNotEmpty(collect)){
+//            String.valueOf(collect.size());
+//        }
+        TableDataInfo dataTable = getDataTable(list);
+        dataTable.setTotal(total);
+        return dataTable;
+
     }
 
     /**
@@ -116,4 +302,245 @@
     {
         return toAjax(bsOrderSchedulingService.deleteBsOrderSchedulingByIds(ids));
     }
+    @GetMapping("/getSumData")
+    public R getSumData(BsOrderScheduling bsOrderScheduling){
+        List<BsOrderScheduling> list = new ArrayList<>();
+        int onlineNum = 0;
+        int finishNum = 0;
+        if (StringUtils.isNotEmpty(bsOrderScheduling.getOrderNo())){
+
+            list = bsOrderSchedulingService.selectBsOrderSchedulingPage(bsOrderScheduling);
+            List<BsOrderScheduling> onlineNumList = list.stream().filter(x -> Constants.ORDER_STATUS_ING.equals(x.getProductionStatus())).collect(Collectors.toList());
+            if (CollUtil.isNotEmpty(onlineNumList)){
+                onlineNum = onlineNumList.size();
+            }
+            List<BsOrderScheduling> finishNumList = list.stream().filter(x -> Constants.FINISH_PRODUCTION.equals(x.getProductionStatus())).collect(Collectors.toList());
+            if (CollUtil.isNotEmpty(finishNumList)){
+                finishNum = finishNumList.size();
+            }
+        }
+        List<BsOrderScheduling> collect = list.stream().filter(x -> Constants.UN_QUALIFIED.equals(x.getQualityStatus())).collect(Collectors.toList());
+        String unqualified = "0";
+        if (CollUtil.isNotEmpty(collect)){
+            unqualified = String.valueOf(collect.size());
+        }
+        SumDataVO vo = new SumDataVO();
+        vo.setFinishNum(finishNum);
+        vo.setOnlineNum(onlineNum);
+        vo.setUnqualified(unqualified);
+        return R.ok(vo);
+    }
+
+    /**
+     * 鏍¢獙鍙戝姩鏈哄彿鏄惁鍜屾満鍨嬪尮閰嶃�佹槸鍚﹂噸澶嶆壂鎻忋�佹槸鍚﹁秴鍑鸿鍒掓暟閲�
+     * @param engineNo 绠变綋鐮�
+     * @param model 鏈哄瀷
+     * @return boolean
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @GetMapping("/engineNoIsInModel")
+    public R engineNoIsInModel(String engineNo,String model,String orderNo,Boolean repairFlag) throws Exception {
+
+        if (StringUtils.isEmpty(engineNo)){
+            return R.fail(500,"绠变綋鐮佷笉鑳戒负绌猴紝璇烽噸璇�");
+        }
+        if (!engineNo.contains(",")){
+            return R.fail(500,"绠变綋鐮佹牸寮忔湁璇紝璇烽噸璇�");
+        }
+        ProductNewPassStation checkStation = new ProductNewPassStation();
+        checkStation.setBoxCode(engineNo);
+        List<ProductNewPassStation> checkList = productNewPassStationService.getProductPassStationList(checkStation);
+        if (!repairFlag){
+            if (CollUtil.isNotEmpty(checkList)){
+                return R.fail(500,"璇峰嬁閲嶅鎵弿绠变綋鐮�");
+            }
+        }
+        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
+        bsOrderScheduling.setOrderNo(orderNo);
+        List<BsOrderScheduling> allList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
+        if (CollUtil.isNotEmpty(allList)){
+            allList.forEach(x -> {
+                if (StrUtil.isNotBlank(x.getWorkingHours())){
+                    x.setWorkingHoursInt(Integer.parseInt(x.getWorkingHours()));
+                } else {
+                    x.setWorkingHoursInt(0);
+                }
+            });
+            allList = allList.stream().sorted(Comparator.comparing(BsOrderScheduling::getWorkingHoursInt)).collect(Collectors.toList());
+        }
+        List<BsOrderScheduling> dlist = allList.stream().filter(x->x.getProductionStatus().equals(Constants.WAIT_PRODUCTION)).collect(Collectors.toList());
+        List<BsOrderScheduling> collect = allList.stream().filter(x -> x.getProductionStatus().equals(Constants.ORDER_STATUS_ING)
+                ||x.getProductionStatus().equals(Constants.FINISH_PRODUCTION)).collect(Collectors.toList());
+        if (CollUtil.isNotEmpty(checkList)){
+            //閲嶅鎵爜
+            ProductNewPassStation productNewPassStation = checkList.get(0);
+            String sfcCode = productNewPassStation.getSfcCode();
+            DaPassingStationCollection passingStationCollection = new DaPassingStationCollection();
+            passingStationCollection.setSfcCode(sfcCode);
+            List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionService.selectDaPassingStationCollectionList(passingStationCollection);
+            if (CollUtil.isNotEmpty(daPassingStationCollections)){
+                //杩囩珯鍚庨噸鏂颁笂绾�
+                //OPC鎿嶄綔
+                logger.info("杩囩珯鍚庨噸鏂颁笂绾�,{}",sfcCode);
+                ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.Code", sfcCode);
+                OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐橲N
+                return R.ok();
+            } else {
+                //OPC鎿嶄綔
+                logger.info("褰撳墠绔欓噸鏂版壂鐮�,{}",sfcCode);
+//                ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP010.ProductTypeSN",sfcCode);
+//                OPCUaSubscription.miloService.writeToOpcUa(entity3);//鍐欎骇鍝丼N鍙峰弽棣�
+                ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.Code", sfcCode);
+                OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐橲N
+                return R.ok();
+            }
+        }else {
+
+            if (CollUtil.isNotEmpty(dlist)){
+                BsOrderScheduling OrderScheduling=dlist.get(0);
+
+                OmProductionOrdeInfo info = new OmProductionOrdeInfo();
+                info.setWorkOrderNo(orderNo);
+                List<OmProductionOrdeInfo> omProductionOrdeInfos = productionOrdeInfoService.selectOmProductionOrdeInfoList(info);
+                if (CollUtil.isNotEmpty(omProductionOrdeInfos)){
+                    OmProductionOrdeInfo omProductionOrdeInfo = omProductionOrdeInfos.get(0);
+                    Long planQty = omProductionOrdeInfo.getPlanQty();
+                    if (planQty<collect.size()){
+                        return R.fail(500,"瓒呭嚭璁″垝鏁伴噺锛岃妫�鏌ュ悗閲嶈瘯");
+                    }
+                }
+                //鎻掑叆鏁版嵁
+                DaParamCollection saveData = new DaParamCollection();
+                saveData.setSfcCode(OrderScheduling.getEngineNo());
+                saveData.setParamValue(engineNo);
+                saveData.setLocationCode("OP010");
+                saveData.setParamCode("XTM");
+                saveData.setParamName("绠变綋");
+                daParamCollectionService.insertDaParamCollection(saveData);
+
+                DaTileMatchCollection MatchCollection = new DaTileMatchCollection();
+                MatchCollection.setSfcCode(OrderScheduling.getEngineNo());
+                MatchCollection.setParamValue(engineNo);
+                MatchCollection.setLocationCode("OP010");
+                MatchCollection.setParamCode("XTM");
+                MatchCollection.setParamName("绠变綋");
+                daTileMatchCollectionService.insertDaTileMatchCollection(MatchCollection);
+
+                if (StrUtil.isNotBlank(OrderScheduling.getEngineNo())){
+                    String snCode = OrderScheduling.getEngineNo();
+                    if (snCode.startsWith("280") || snCode.startsWith("380")){
+                        ProductNewPassStation productNewPassStation = new ProductNewPassStation();
+                        UUID uuid = UUID.randomUUID();
+                        productNewPassStation.setId(uuid.getMostSignificantBits());
+                        productNewPassStation.setFinishFlag("0");
+                        productNewPassStation.setSfcCode(OrderScheduling.getEngineNo());
+                        productNewPassStation.setCreateTime(new Date());
+                        productNewPassStation.setBoxCode(engineNo);
+                        if (snCode.startsWith("280")){
+                            productNewPassStation.setProductType("280");
+                        } else {
+                            productNewPassStation.setProductType("380");
+                        }
+                        productNewPassStationService.insertPassStation(productNewPassStation);
+                    }
+                }
+
+                //鏇存柊涓婄嚎鏁伴噺
+                int onlineNum = 0;
+                List<BsOrderScheduling> onlineNumList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling)
+                        .stream().filter(x -> Constants.ORDER_STATUS_ING.equals(x.getProductionStatus())||x.getProductionStatus().equals(Constants.FINISH_PRODUCTION)).collect(Collectors.toList());
+                if (CollUtil.isNotEmpty(onlineNumList)){
+                    onlineNum = onlineNumList.size();
+                }
+                OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo();
+                omProductionOrdeInfo.setWorkOrderNo(orderNo);
+                List<OmProductionOrdeInfo> omList = productionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
+                if (CollUtil.isNotEmpty(omList)){
+                    OmProductionOrdeInfo omInfo = omList.get(0);
+                    String s = String.valueOf(onlineNum);
+                    long l = Long.parseLong(s);
+                    omInfo.setActualOnlineQty(l);
+                    productionOrdeInfoService.updateOmProductionOrdeInfo(omInfo);
+                }
+
+                //OPC鎿嶄綔
+                ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.Code", OrderScheduling.getEngineNo());
+                OPCUaSubscription.miloService.writeToOpcUa(entity);//鍐橲N
+
+
+                OrderScheduling.setProductionStatus("2");
+                bsOrderSchedulingService.updateBsOrderScheduling(OrderScheduling);
+                return R.ok();
+            } else {
+                return R.fail(500,"瓒呭嚭璁″垝鏁伴噺锛岃妫�鏌ュ悗閲嶈瘯");
+            }
+
+        }
+
+    }
+
+
+    @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;
+    }
 }

--
Gitblit v1.9.3